I've been testing on uploading files and I encountered a weird bug while testing it out because on the initial uploading of the file, my localhost uploads it to the root directory of my xampp rather than in the directory inside my htdocs folder. To make things clear here's what happened.

1.) I upload my file from a page in http://localhost/fileupload/upload.html, which is equivalent to my "C:\xampp\htdocs\fileupload" directory.

3) After the initial upload the file is stored in the "C:\xampp" folder instead of the fileupload folder mentioned above.

4) I tried uploading again, that's when it stores the uploaded files to my uploaded folder.

5) When I deleted the copy on the "C:\xampp" folder and uploaded the file again, it's there again and it didn't replace the copy on the "C:\xampp\htdocs\fileupload" directory.

From this, I deduced that if it doesn't see a copy of a file in the "C:\xampp" directory, the upload goes there. If the file exists, that's the only time it uploads it to the same directory as my page. Is this a config issue or a security issue? Can anyone shed some light on this matter?



11 Years
Discussion Span
Last Post by vssp

Might be the current working directory issue. Try specifying absolute path when copying the uploaded file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.