There was a problem uploading images to the server (local Openserver)

after i click submit this is what happens

Array ([userfile] => Array ([name] => banner_970kh80-04.png [type] => image / png [tmp_name] => E: \ OpenServer \ userdata \ temp \ php56B4.tmp [error] => 0 [size] => 40162))

here is the script itself

<?php $uploaddir = 'images/'; $apend=date('YmdHis').rand(100,1000).'.jpg'; $uploadfile = "$uploaddir$apend"; if(($_FILES['userfile']['type'] == 'image/gif' || $_FILES['userfile'] ['type'] == 'image/jpeg' || $_FILES['userfile']['type'] == 'image/png')|| $_FILES['userfile']['type'] == 'image/jpeg' && ($_FILES['userfile']['size'] != 0 and $_FILES['userfile']['size']<=512000)) if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "Файл загружен. Путь к файлу: <p>http:/yoursite.ru/".$uploadfile." </p>"; } else { echo "Загружаемое изображение превышает допустимые нормы (ширина не более - 500; высота не более 1500)"; unlink($uploadfile); // удаление файла } } else { echo "Файл не загружен, вернитеcь и попробуйте еще раз"; } } else { echo "Размер файла не должен превышать 512Кб"; } ?> 
  • Images are not uploaded to the folder - vovaxxx
  • At the root of the site is the images folder, which in theory should be an image, but after clicking send it gives me an Array array ([userfile] => Array ([name] => banner_970kh80-04.png [type] => image / png [ tmp_name] => E: \ OpenServer \ userdata \ temp \ php56B4.tmp [error] => 0 [size] => 40162)) and that's it, I tried different scripts, the result is the same - vovaxxx
  • maybe there is no write permission - chmod ('images /', 0777) add to the beginning of the file - G.Denis
  • did not help (((the fact is that it does not display an error message, the script takes an image, but some leshe gives me an array and does not copy the file into a folder - vovaxxx
  • Is it exactly that script? I, for example, do not see any conclusion here. Add some echo "test" at the beginning of the script; to make sure that this is the right script. Then add echo "such action" to all if; to understand how your script works - koks_rs

0