PHP can't upload?

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!

Moderator: General Moderators

Post Reply
Jubbens
Forum Newbie
Posts: 6
Joined: Sat Jun 04, 2005 4:54 pm

PHP can't upload?

Post 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.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

Jubbens
Forum Newbie
Posts: 6
Joined: Sat Jun 04, 2005 4:54 pm

Post by Jubbens »

yes.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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?
Jubbens
Forum Newbie
Posts: 6
Joined: Sat Jun 04, 2005 4:54 pm

Post 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.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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.
Jubbens
Forum Newbie
Posts: 6
Joined: Sat Jun 04, 2005 4:54 pm

Post by Jubbens »

...what was I supposed to change?

I just changed the URL and uploaddir.
Jubbens
Forum Newbie
Posts: 6
Joined: Sat Jun 04, 2005 4:54 pm

Post by Jubbens »

Another point of interest is that it can't delete files either.
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post by hongco »

maybe you need to chmod them to 777 :)
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

hongco wrote:maybe you need to chmod them to 777 :)
Don't chmod to 777
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Post 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.:roll:

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.
Post Reply