There is a code

$image = $_FILES['img']; //echo (print_r($_FILES['img'])); { if (move_uploaded_file($image['tmp_name'],'/../web/avatars/')) return 'success'; else return 'failure'; } 

Attempting to download the file returns the error failed to open stream: No such file or directory & # 039

  • 2
    /../web/avatars/ - are you sure of this way? - Unick
  • I wrote the path relative to the php file. is my mistake in this? - Gadzhimurad Magomedov
  • one
    You wrote not about the file, but about the file system. '/' means system root, '..' means one level up. And a level above the root can be nothing. In general, remove the '/' at the beginning of the path - Vladimir Novopashin
  • Now everything works. many thanks - Gadzhimurad Magomedov

1 answer 1

 $image = $_FILES['img']; //echo (print_r($_FILES['img'])); { if (move_uploaded_file($image['tmp_name'],'../web/avatars/')) return 'success'; else return 'failure'; }