1 Replies - 1714 Views - Last Post: 24 May 2005 - 02:39 PM Rate Topic: -----

#1 jcomputer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 22-April 05

php uploader

Posted 24 May 2005 - 02:33 PM

Hi i am trying to get a user upload section on my site but i am having difficulty with the add-ons items i need from the script i foudn on the web.

this is what i have www.pspgamesaves.com/upload.php now currently only the file uploads. i need the other fields to be collected and put in a text file with the same name of the uploading zip file.
in the text file will be the name of the game, version, description, and username.
If anyone knows the coding to add to make this separate file or what i should do to get it to work please let me know.

Is This A Good Question/Topic? 0
  • +

Replies To: php uploader

#2 supersloth  Icon User is offline

  • serial frotteur - RUDEST MEMBER ON D.I.C.
  • member icon


Reputation: 4503
  • View blog
  • Posts: 28,411
  • Joined: 21-March 01

Re: php uploader

Posted 24 May 2005 - 02:39 PM

i believe you would just take those variables on the page you submit and use fwrite to create your file with txt. like so

<?php
$filename = 'test.txt';
$somecontent = "Add this to the file\n";

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

   // In our example we're opening $filename in append mode.
   // The file pointer is at the bottom of the file hence
   // that's where $somecontent will go when we fwrite() it.
   if (!$handle = fopen($filename, 'a')) {
         echo "Cannot open file ($filename)";
         exit;
   }

   // Write $somecontent to our opened file.
   if (fwrite($handle, $somecontent) === FALSE) {
       echo "Cannot write to file ($filename)";
       exit;
   }
  
   echo "Success, wrote ($somecontent) to file ($filename)";
  
   fclose($handle);

} else {
   echo "The file $filename is not writable";
}
?> 


read up on fwrite here http://us2.php.net/m...tion.fwrite.php
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1