Page 1 of 1
PHP can't upload?
Posted: Sat Jun 04, 2005 5:12 pm
by Jubbens
Hi. I'm a newbie to the forum and a newbie to php.
I've tried 4 different php upload scripts, but none of them work. They all say "upload failed" or some other generic error. I've looked through php.ini to check the settings, and this is what it's like:
safe mode: off
register globals: on
uploads: on
It's php 4 on apache on a Fedora Core 3 web server. Is there anything else I should check? I've been at this all day. Thanks.
Posted: Sat Jun 04, 2005 5:19 pm
by shiznatix
Posted: Sat Jun 04, 2005 5:28 pm
by Jubbens
yes.
Posted: Sat Jun 04, 2005 5:37 pm
by Ambush Commander
Okay, can you post all four code examples (as you used them), give us the filename/filetype of the file you tried to upload, and tell us the max_fileupload size?
Posted: Sat Jun 04, 2005 5:52 pm
by Jubbens
The max file size is 8MB, and all the files were under the limit.
I tried "Quix", "PHPExploreIt", "PHP Uploader" and that example from the PHP site. I don't think it's a problem with the scripts.
I tried uploading .gif, .html, etc. all formats were configured to be allowed in the scripts.
Posted: Sat Jun 04, 2005 5:56 pm
by Ambush Commander
Yes, I know you used the example, but don't expect the example to work if you just copy and paste it to a PHP script. You must have done some editing. It would be helpful if we could see that.
Posted: Sat Jun 04, 2005 6:18 pm
by Jubbens
...what was I supposed to change?
I just changed the URL and uploaddir.
Posted: Sat Jun 04, 2005 7:12 pm
by Jubbens
Another point of interest is that it can't delete files either.
Posted: Sun Jun 05, 2005 12:34 am
by hongco
maybe you need to chmod them to 777

Posted: Sun Jun 05, 2005 1:02 am
by hawleyjr
hongco wrote:maybe you need to chmod them to 777 :)
Don't chmod to 777
Posted: Sun Jun 05, 2005 1:21 am
by hongco
the reason for chmoding 777 is to find the reason why. Saying do not chmod 777 without any further explanation does not help anything in this matter.
if you do not want to chmod, then use other means to have write permission. If you are on shared hosting, then do not leave folder with write permission (people on the same server can hack your site).
I normally use ftp function to chmod the folder, when the job is done, chmod the folder again to prevent write permssion.