PHP başka [kapalı] çalışmıyor move_uploaded_file

5 Cevap php

Gerçekten, bu bir çözemiyorum sadece var bir temel yükleme komut ama dosya alışkanlık yükleyin.

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 / var / tmp dosyasına bakın / ama hareketli sadece, hiç hata bir şey çalışmıyor.

Ben gerçekten bir şey bakan muyum?

Önceden teşekkürler!

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

Debug: tmp file :/ tmp/phpgYOo9a

Debug: hedef dizin: / var / www / clubgevoel / public / img / producten /

Debug: gerçek hedefi: / var / www / clubgevoel / public / img / producten

Debug: Kaynak okunabilir:

Debug: Hedef is_dir: evet

Debug: Hedef yazılabilir: evet

Debug: hamle: bool (false)

5 Cevap

Debug: tmp file :/ tmp/phpgYOo9a

Debug: hedef dizin: / var / www / clubgevoel / public / img / producten /

Debug: gerçek hedefi: / var / www / clubgevoel / public / img / producten

Debug: Kaynak okunabilir:

Debug: Hedef is_dir: evet

Debug: Hedef yazılabilir: evet

Debug: hamle: bool (false)

Sunucuda tam dosya kotası?

(yani yanlış döndürür) başarısız olursa move_uploaded_file bir uyarı olmalıdır. Bu gibi TÜM bir error_reporting On display_errors ile yükleme komut dosyasını test etmek için emin olun:

ini_set ('display_errors', 1);

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

Bu satırları komut şeyden önce konulmalıdır. En az hata nedenini keşfetmek olabilir Bu şekilde

i y ilişkin bir destination.Try olarak ablolute yolunu kullanarak sanırım

Ne yapar .... en fazla debug çıktısını toplayalım

// "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";

yazdırabilir?