![]() |
| Upload file through php |
|
libonati
|
Hello,
I'm trying to upload files through php. I really don't understand where is the mistake. I've set 777 permission to files folder. Below there are few lines of code I've used to test the upload. Do you notice some errors? I'm on a linux builder plus plan. Thank you in advance for any help. Luca
|
||||||||||||||
|
|
|||||||||||||||
|
mgwalk
|
Can you look in your error.log file
For the error and line number. |
||||||||||||
|
|
|||||||||||||
|
cburns
|
Try placing another forwardslash in front of vservers, so it looks like:
$target = "/vservers/mysite/htdocs/upload/files/".basename($_FILES['uploaded']['name']); PHP may be trying to place the file into the wrong directory. You may want to try toning the permissions down to 755. We run PHP under suexec so that the scripts will run as your specific user. Suexec REALLY doesn't like 777 permissions and has a tendency to freak out when they are set like that. If those don't work, open a ticket with us if you haven't already. We can give you access to your logs if you don't already have it and we can point you in the right direction. We're always here to help |
||||||||||||
|
|
|||||||||||||
|
msdi
|
Also, move_uploaded_file() will set the file permissions to 0600. If you plan on letting users access files directly (as opposed to through a redirect script), then you'll want to set the permissions with chmod() after it's copied.
|
||||||||||||
|
|
|||||||||||||
|
darnold
|
I don't believe this is a problem on HMS servers. I've seen other people mention it but I have plenty of working examples uisng move_uploaded_file without said permission issue. It may be a problem with servers that do not run php as a cgi with suexec. I'm pretty sure cburn nailed it. The first / slash represents the root of the server. Without it php will think you are giving it a relative path starting from vservers and that is not going to exist. |
|||||||||||||
|
|
||||||||||||||
| Upload file through php |
|
||
|


