PDA

View Full Version : php: move_uploaded_file gets lost



oldman
01-07-2007, 10:23 AM
I'm playing with php:
<form enctype='multipart/form-data' action='myhandler.php' method='POST'>
and that end works but when I pick up the file in 'myhandler.php' and use move_uploaded_file, the attempt goes through (true) but the file never makes it. I'm useing

$uploadfile = $_SERVER['DOCUMENT_ROOT']."/Uploaded/test.jpg";
move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);

I printed the $_FILES, and all seems in order? I think the glitch is in the destination ($uploadfile). Any help?

oldman
01-08-2007, 07:14 AM
I tried the code a short time later and it appears to work? Before, even after a refresh, the file didn't move. Mongo only pawn in great game of life!

Jarrod
01-10-2007, 03:02 PM
When you are using an upload script, besure that php.ini is edited to handle large files, default is 2MB. Anything larger than that will not be uploaded.

Schelly
01-11-2007, 10:06 AM
Mongo only pawn in great game of life!

ROFL!!!

Another favorite is "Sed-a-GIVE???"

;)

dug
01-14-2007, 01:16 AM
do you have write permission on the folder /Uploaded ?

( you should chmod it to 0777 )

Also note that $_FILES is an array, e.g. print $_FILES; outputs

Array()

To see the contents of the $_FILES server variable ( for debugging ) use

print_r($_FILES);

And for the uploaded files array,

print_r($_FILES['uploadedfile']);

More useful info and examples here:

http://www.tizag.com/phpT/fileupload.php