While uploading images files on the live server I have stuck in a strange issue that the move_uploaded_files() function returns true but the image does not get uploaded.
if(move_uploaded_file($_FILES["img"]["tmp_name"],'./shot_images/'.$_FILES["img"]["name"])){
echo "Success";
}
Here, when executed, prints “Success” but the file is not being uploaded on the specified location.
Any kind of help is appreciated.
If
move_uploaded_fileis returningtruethen that indicates the file was moved successfully. Let’s try some debugging. What happens when you use the following code:I suspect it is working, it’s just not going where you expect…
If this is the case, it might be due to `’./shot_images/’ — personally I rarely (if ever) use relative paths like that. I find it eliminates confusion if I reference the path to the script: