PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi!
I'm trying to write a script that will upload files to the server on my website. But I getting this annoying errer message that I don't under stand. Can somebody help me solve it please?
The error message is:
[quote]
Warning: move_uploaded_file(/home/uploads/lecture13.pdf): failed to open stream: No such file or directory in /home/emergosim/scripts/laddaupp.php on line 51
Warning: move_uploaded_file(): Unable to move '/tmp/phpaqBy9p' to '/home/uploads/lecture13.pdf' in /home/emergosim/scripts/laddaupp.php on line 51
[/quote]
I'll supply you with the code aswell:
Hopefully someone can help me translate what the server i trying to tell me. By the way, the file permissions on all the folders that I wan't to upload to are 757.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Do the folder(s) exist that you are trying to put these files into? Are their permissions set properly? Also, I noticed that your original error message differes slightly from the file name you recently posted. That may mean that something is not resolving properly in the code.
Sorry guys. My mistake. I copied an old error message into the original post. This one is correct though:
Warning: move_uploaded_file(home/dokument/modeller/nya_versioner/lecture13.pdf): failed to open stream: No such file or directory in /home/emergosim/scripts/laddaupp.php on line 53
Warning: move_uploaded_file(): Unable to move '/tmp/phpJ008im' to 'home/dokument/modeller/nya_versioner/lecture13.pdf' in /home/emergosim/scripts/laddaupp.php on line 53
The folders do exist on the server and the permissions are all set to 757. Could there be a problem for PHP to find the website root with the path that I use. Is it correct to write "home/..." to address the root for the website on a linux server running apache?
feyd wrote:So the question is: does /home/emergosim/scripts/home/dokument/modeller exist? That's what you're asking for PHP to store the file into.
Ok. That explains it. I changed the $path variable from "home/dokument" to "../dokument". That did the trick. Thanks for helping me guys. Sometimes you just get into a hole where you don't see the way out so you need someone to show you the way.