PDA

View Full Version : uploading files with php problem



somjai
10-25-2004, 08:36 AM
Hi
I was hoping someone might help me with this problem. I have a page with a file upload option, but when you try to upload a file you get this

Warning: copy(/home/saltwat/public_html/images/headerbanner.jpg): failed to open stream: Permission denied in /home/saltwat/public_html/forms/formmail.php on line 362

Warning: Cannot modify header information - headers already sent by (output started at /home/saltwat/public_html/forms/formmail.php:362) in /home/saltwat/public_html/forms/formmail.php on line 411

I would really appreciate some help or suggestions
Thank you
kind regards
Somjai

mushroom
10-25-2004, 02:38 PM
Warning: copy(/home/saltwat/public_html/images/headerbanner.jpg): failed to open stream: Permission denied in /home/saltwat/public_html/forms/formmail.php on line 362
Permissions in /home/saltwat/public_html/images/ are not set correctly, they need to be set to "777" or "xrw xrw xrw", so that php can write to the directory.

Warning: Cannot modify header information - headers already sent by (output started at /home/saltwat/public_html/forms/formmail.php:362) in /home/saltwat/public_html/forms/formmail.php on line 411
Only means that the first error happened before your headers where sent.

steve0
10-25-2004, 07:07 PM
Make sure the owner of the file also has ownership of the target directory.. i.e. "apache" or "nobody"
Usually the process the webserver is running as..

e.g.
-rw------- 1 apache apache 1816 Oct 31 23:59 uploadimage.php

drwx------ 2 apache admin 4096 Oct 31 12:00 filetargetdirectory


Also .. 777 BAAAAD .. that means the directory is readable, writeable and EXECUTABLE by everyone..

You can get by with 755


Regarding the header.. there should be nothing written to the screen i.e. no output.. echo, printf etc.. before the header(); setcookie() or other similar call..

somjai
11-13-2004, 01:08 AM
Thank you for your answers
I haven't fixed the problem yet though
have taken the page off until I can work it out

Thanks again
Somjai

Claud
11-13-2004, 04:18 PM
I would like to ask something too regarding php and the upload page. I also have an upload page set up but I can't upload more than 20 Mb. I know that I have to modify something on the files on the server to have permission for more, but I'm not sure exactly what are the changes I have to make. Anyone can help me? Thank you in advance.

Easywebdev
11-13-2004, 04:59 PM
You need to alter the upload_max_filesize in your php.ini file.

If you have access to your server files and can edit them then edit the upload_max_filesize to whatever size you think you need.

To find out where the file is you can type the command
locate php.ini
and it will show you where it is.