Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,628 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,034 people online right now. Registration is fast and FREE... Join Now!




php uploader

 
Reply to this topicStart new topic

php uploader

jcomputer
post 24 May, 2005 - 01:33 PM
Post #1


New D.I.C Head

*
Joined: 22 Apr, 2005
Posts: 8

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.
User is offlineProfile CardPM

Go to the top of the page

supersloth
post 24 May, 2005 - 01:39 PM
Post #2


serial frotteur

Group Icon
Joined: 21 Mar, 2001
Posts: 19,521



Thanked 11 times

Dream Kudos: 2147483647

Expert In: being gentlemanly

My Contributions


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

CODE

<?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/manual/en/function.fwrite.php
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 03:40AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month