1
votes

my code works fine in WAMP server without any warning. But when I upload same code on my server it shows me these arror.

[function.move-uploaded-file]: failed to open stream: No such file or directory

my php file contain following line. $ran is random name generated by system. I want file name hidden, so I kept random function for that.

move_uploaded_file($_FILES['file']['tmp_name'], "users/jagdish/".$ran);

I also tried full path "/home/user/public_html/" instead of giving only "users/".

There are two errors. My upload.php is located at /public_html/jagdish/upload/upload.php

Warning: move_uploaded_file(/home/noyosdzy/public_html/jagdish/upload/users/jagdish/d406235ed72be6c41dbe2c00798a6e86fc28510f1359788762) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/noyosdzy/public_html/jagdish/upload/upload.php on line 118

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php3ww2M8' to '/home/noyosdzy/public_html/jagdish/upload/users/jagdish/d406235ed72be6c41dbe2c00798a6e86fc28510f1359788762' in /home/noyosdzy/public_html/jagdish/upload/upload.php on line 118

I tried different combinations also. But doesn't work. It works perfectly on WAMP. But not working on my web server.

1
Are you creating the directory dynamically using $ran variableAfsar
Have you actually checked that the file exists? Did you follow the exact url?m.spyratos
@zan no I am not creating directory dynamic.jagdish
@MikeSpy How I check that file is exists at "temp" folder.jagdish
Does the directory /home/noyosdzy/public_html/jagdish/upload/users/jagdish/ already exist?Barmar

1 Answers

0
votes

i had a similar issue, but to be frank my issue was with a pipe character in the filename. please check whether your filename has any special characters.