move_uploaded_file doesn't move files - problem with apache configuration in OpenSuse
I’m new to PHP and am trying to figure out how to make move_uploaded_file to work.
To test and learn PHP I use public_html folder in my home dir, that is: /home/wojtek/public_html. I access it like this: localhost/~wojtek/[…]
The server root is /srv/www/htdocs.
Let me show the code. It comes from ‘Head First PHP’ book. Here you go: http://pastie.org/4809762
The problem is that an uploaded file doesn't reach the temporary folder for uploaded files. I set it to ‘/srv/www/tmp’. Here is the output of ‘ls’ command:
I don’t even know where the temporary folder should go :(
drwxrwxrwx 2 root www 4096 Sep 26 17:33 tmp
Apache belongs to ‘www’ group so I added myself to that group too.
And here is another problem.*:) I don’t altogether know what path should I use – absolute or relative? I tried with:
// define application constants
• images/ (the script is in guitarwars/)
and none worked.
The script works. I get no errors. And I even get the temporary name of an uploaded file.
I tried somehow make $_SERVER['DOCUMENT_ROOT'] to work – to get the root of public_html but I always get /srv/www/htdocs.
So I’m completely confused. I don’t know:
• where should temporary folder be created (in /srv/www/[…] or in public_html?)
• why is the temporary folder always empty (no files even when there is no error when file is uploaded)
• what destination path of move_uploaded_file should I*use (absolute, relative (relative to what?))
I hope this is not a tricky question and you guys can help me. Thanks in advance!