PHP File Upload ... files disappear into a big void .. where no one can hear them scream

I am running Ubuntu8.041. Apache / 2.2.8 (Ubuntu) PHP / 5.2.4-2ubuntu5.3 with Suhosin-Patch setup

Can't get file uploads to work at all. Tested locally in Ubuntu box ... and from my Vista Box. Ubuntu runs inside VMWare in a Vista box.

Here you can download TestBrowse.php

<?php
?>
<form enctype="multipart/form-data" action="uploadTestBrowse.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input type="file" name="fileName" /> <br><br>
<input type="submit" value="Upload Images"/> 
</form>

      

Here dump TestSubmit.php

<?php
error_reporting(E_ALL|E_STRICT);  

$uploaddir = "var/www/ig/images/";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "Success.\n";
} else {
    echo "Failure.\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);
?>

      

Here is the result of uploadTestSubmit.php

Note: Undefined index: userfile in /var/www/ig/admin/uploadTestSubmit.php on line 5

Note: Undefined index: userfile in /var/www/ig/admin/uploadTestSubmit.php on line 7 Error. Here's some more debugging information: Array ([fileName] => Array ([name] => aq.jpg [type] => image / pjpeg [tmp_name] => / tmpUpload / phpMBwMi9 [error] => 0 [size] = > 10543))

php.ini file_uploads = On upload_max_filesize = 2M upload_tmp_dir = / tmpUpload

I have chmod -R 777 tmpUpload

I never see files in tmpUpload

Apache2 error log shows nothing

Apache2 access log showing: 192.168.21.1 - - [06 / Dec / 2008: 13: 13: 09 +1300] "GET / ig / admin / uploadTestBrowse.php? = PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP / 1.1 "200 2146" http://192.168.21.128/ig/admin/uploadTestBrowse.php "" Mozilla / 4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618) "

+1


source to share


2 answers


Your uploadTestBrowse.php and uploadTestSubmit.php are not the same. Various names in action

and fields to download.



+1


source


This may not be the answer to your problem, but I notice that you are missing / in front of var / www / ...

It should be: "/ var / www / ig / images /"



My first suggestion was to change that and give it one more step.

+1


source







All Articles