Jump to content

Cant upload to directory owned by Apache


Mortier

Recommended Posts

Hello people!

I'm experiencing some problems with my upload script. I have written my own upload script and it uploads to a directory made in that same script. The problem is that due to the SAFE MODE the upload fails.
When I set the permission of the directory to 777 it still doesn't work. I think it has to do with the GID & UID because the directory is Apache and the script-owner is me (ftp account).

I can not alter any settings because I use a webhost.

[b]This is the error:[/b]
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 558 is not allowed to access /home/ivograsman/domains/ivograsman.nl/public_html/ogp/img/artikelen/2 owned by uid 101 in /home/ivograsman/domains/ivograsman.nl/public_html/ogp/test.php on line 14
[b]There are no $_FILES errors.[/b]

Hope you people can help me!

Greetings,

Alex
Link to comment
Share on other sites

Hey

A note on the COPY function on php.net: ## move_uploaded_file Bypasses safe mode and base_dir securities (the function is totally safe, no danger) ##

Here is the function reference:
http://www.php.net/manual/en/function.move-uploaded-file.php

Note: move_uploaded_file() is not affected by the normal safe mode UID-restrictions. This is not unsafe because move_uploaded_file() only operates on files uploaded via PHP.

Hope it helps.
Link to comment
Share on other sites

I don't really see what you exactly mean but I've been trying:

To use the copy function which gives the same error. I've checked the manual for move_uploaded_file() and in the Dutch manual @ http://nl3.php.net/manual/nl/function.move-uploaded-file.php

There's the following statement:
[i]Opmerking: Als safe-mode aan staat, zal PHP kijken of de bestanden of directories waarmee je wilt werken dezelfde UID heeft als het script dat wordt uitgevoerd.[/i]
I can not find this sentence in the English manual, weirdly.
Translation is:
[i]Note: If safe-mode is turned ON, PHP will check if the file or directories you choose to work with have the same UID as the executing script[/i]
This sentence describes the problem perfectly, but does not come with a solution.

But I don't get it because you say:
[i]move_uploaded_file() is not affected by the [b]normal[/b] safe mode UID-restrictions[/i]
This situation is then not a 'normal' one I suppose.

Thanks for your help, though I haven't found a solution yet.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.