Jump to content


Photo
- - - - -

File upload


  • Please log in to reply
No replies to this topic

#1 mattallard

mattallard

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 23 June 2005 - 01:51 PM

To allow multiple files to be uploaded and handled by PHP you must go through each file from the form with enctype "multipart/form-data" and handle the file.
This can be done fairly easily with a foreach loop through the files.

<? 
foreach($_FILES as $tagname=>$objekt){
  $tempName = $objekt['tmp_name']; //the temporary name of file on server
  $fileType  $objekt['type']; //the type of the file
  $fileName  $objekt['name']; //original name of file
  $myPath = "myserver/mydir/"; //path for file upload
  move_uploaded_file($tempName, $myPath); //move file from temp dir to your path

}//end for loop
?>

This is all you need to process n number of file objects from the html form.

Go to Mighty Pixels for all your multimedia needs.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users