tags:

views:

139

answers:

6

Guys help me out!

I really can't figure this one out, just got a basic upload script but the file wont upload.

Form 
 => enctype is set

print_r($_FILES['Product_Thumb']) 
 => [Product_Thumb] 
  => Array ( 
      [name] => prototype.js 
      [type] => application/x-javascript 
      [tmp_name] => /tmp/phpXzL6CT 
      [error] => 0 
      [size] => 139854 ))

I did set the permissons (-R) to 777 on the upload folder. Changed the owner:group to www-data:www-data.
Mkdir works on the exact path I used for the upload file. Tried different files, tried another folder, hardcoded the destination filepath, still doesnt work.

I see the file in /var/tmp/ but the moving is just not working, no error nothing at all.

Am I really overlooking something?

Thanx in advance!

======================================================================= Debug output:

Debug: tmp file:/tmp/phpgYOo9a

Debug: target directory: /var/www/clubgevoel/public/img/producten/

Debug: real target: /var/www/clubgevoel/public/img/producten

Debug: source readable:

Debug: target is_dir: yes

Debug: target writable: yes

Debug: move: bool(false)

A: 

Full file quota on the server?

Artjom Kurapov
You mean in the tmp dir or diskspace?Free space enough, server is an Ubuntu 9 with apache2 en php5.Also removed all the files from /var/tmp to see if that helped, no it didnt :)
Johan
does simple copy() method work?
Artjom Kurapov
A: 

move_uploaded_file should issue a warning if it fails(i.e. returns false). Make sure to test the uploading script with display_errors to On an error_reporting to ALL, like this:

ini_set('display_errors', 1);

error_reporting(-1);//or error_reporting(E_ALL); (http://de2.php.net/manual/en/function.error-reporting.php)

These lines should be placed before anything else in your script. This way you could at least discover the reason for the error

alexb
gives me absolutely no errors or warnings at: move_uploaded_file($_FILES['Product_Thumb']['tmp_name'], '/var/www/clubgevoel/public/img/producten/tralalala.jpg');
Johan
A: 

i guess y are using ablolute path as destination.Try the relative one

ntan
when I use: S_SERVER['DOCUMENT_ROOT'] . 'public/img/producten/' . $_FILES['Product_Thumb']['name'] still not uploading.
Johan
A: 

Can this perhaps be an issue with Zend?

Johan
A: 

Let's add more debug output.... What does

// "also tried: move_uploaded_file($_FILES['Product_Thumb']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/clubgevoel/public/img/producten/2.jpg');"
error_reporting(E_ALL); ini_set('display_errors', 1);
$targetDir = $_SERVER['DOCUMENT_ROOT'] . '/clubgevoel/public/img/producten/';
$realTargetDir = realpath($targetDir);

ini_set('display_errors', 1);
echo '<pre>Debug: tmp file:', htmlspecialchars($_FILES['Product_Thumb']['tmp_name']), "</pre>\n";
echo '<pre>Debug: target directory: ', htmlspecialchars($targetDir), "</pre>\n";
echo '<pre>Debug: real target: ', htmlspecialchars($realTargetDir), "</pre>\n";
echo '<pre>Debug: source readable: ', is_readable($_FILES['Product_Thumb']['tmp_name']), "</pre>\n";
echo '<pre>Debug: target is_dir: ', is_dir($targetDir) ? 'yes':'no', "</pre>\n";
echo '<pre>Debug: target writable: ', is_writeable($targetDir) ? 'yes':'no', "</pre>\n";

$b = move_uploaded_file($_FILES['Product_Thumb']['tmp_name'], $targetDir. '2.jpg');
echo '<pre>Debug: move: '; var_dump($b); echo "</pre>\n";

print?

VolkerK
A: 

Debug: tmp file:/tmp/phpgYOo9a

Debug: target directory: /var/www/clubgevoel/public/img/producten/

Debug: real target: /var/www/clubgevoel/public/img/producten

Debug: source readable:

Debug: target is_dir: yes

Debug: target writable: yes

Debug: move: bool(false)

Johan
seems the source isnt readable, any ideas for this 1?
Johan
Please edit your question and add the additional information (instead of posting it as an *answer*)
soulmerge