Date: 11/29/05 (PHP Community) Keywords: php I'm having trouble with uploading images via php. } if (isset($_POST['submitflag'])) { foreach ($_FILES['photo'] as $key => $value) { echo "$key = $value "; } echo ''; } // Move the uploaded file to the Member Photos Directory. $uploaddir = 'D:\\TravelNet\\Member%20Photos\\'; $uploadfile = $uploaddir . basename($_FILES['photo']['name']); echo ' '; if (move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.; } else { echo "Possible file upload attack!; } echo 'Here is some more debugging info:'; print_r($_FILES); print ""; ?> include('./footer.inc.php'); ?> And here's the output from the post and the files array... member_number = 295400 MAX_FILE_SIZE = 1048576 submitflag = Submit name = Feeling-Blue.jpg type = image/jpeg tmp_name = C:\PHP\uploadtemp\php177A.tmp error = 0 size = 22304 Warning: move_uploaded_file(D:\TravelNet\Member%2 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\PHP\uploadtemp\php177A.tmp' to 'D:\TravelNet\Member%20Photos\Feeling-Bl Possible file upload attack! Here is some more debugging info:Array ( [photo] => Array ( [name] => Feeling-Blue.jpg [type] => image/jpeg [tmp_name] => C:\PHP\uploadtemp\php177A.tmp [error] => 0 [size] => 22304 ) ) Any help you guys can provide would be appreciated. Source: http://www.livejournal.com/community/php/371253.html
|