WordPress.org

Ready to get started?Download WordPress

Forums

Image uploading Safe mode (11 posts)

  1. Squit
    Member
    Posted 8 years ago #

    It's really cool that WordPress wants to create directories for my uploaded images but my hosting provider uses Safe Mode the strange thing is wordpress can create directories but i cannot upload in to them ... does anyone have anysuggestion how i can solve this problem ? I tried turning off safe mode but my hosting provider doesn't want to do that but they won't give me an alternative solution beside creating directories via FTP

  2. umit
    Member
    Posted 8 years ago #

    i am not in safe mode but here is the error when i try to upload images:
    "Warning: move_uploaded_file(/home/site/public_html/zine/wp-content/uploads/2005/12/3stars.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/site/public_html/zine/wp-admin/admin-functions.php on line 1757

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpJ6oTDn' to '/home/site/public_html/zine/wp-content/uploads/2005/12/3stars.jpg' in /home/site/public_html/zine/wp-admin/admin-functions.php on line 1757
    The uploaded file could not be moved to ."

    Hope it will be fixed in final release and hope it give us options to upload images to a particular directory like in wp1.5.

  3. schestowitz
    Member
    Posted 8 years ago #

    Some people complained about the excessive number of directories and the very many levels. You might wish to alter the code (not recommended unless you know what you are doing) to manage images in one flat directory structure. Otherwise, you could write a script to build all the directories you will ever need, e.g. (pseudo-code, not bash)

    for year=2005:2007
       mkdir $year
       for month=1:12
           mkdir %month
           for day=1:31 # can afford spares
             mkdir $day
           end
        end
    end

    (or ask the sysadmin to run the script for you)

  4. umit
    Member
    Posted 8 years ago #

    one flat directory is best solution for me. i will modify the old upload.php page. or i will install a full blown gallery script :)

    wp2.0 is almost perfect tho...

  5. Squit
    Member
    Posted 8 years ago #

    Well my safe_mode problem is solved a few emails and some good arguments was enough to let them turn of safe_mode for my domain.

    One of my arguments was that they were offering a WordPress and Gallery installations via PLESK and since both (note the future final wordpress 2.0 release) of them need safe_mode off it was clear for them to turn it off... i hope they'll turn it off by default with their next upgrade... :D

  6. planettelex
    Member
    Posted 8 years ago #

    I'm having a similar issue to umit with the latest 2.0 upgrade. I actually use two seperate servers, one the upgrade has worked perfectly and in the other the only issue I'm having is with the new upload facility.

    I've set all permissions to 777 to be sure and it's not likely that the server will run without safe mode.

    While the previous (1.5) upload features worked I'm now receiving one of two errors when attempting to upload in 2.0:

    Error 1
    Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 10112 is not allowed to access /home/httpd/vhosts/digitalorthodoxy.com/subdomains/lectionary/httpdocs/wp-content/uploads/2005/12 owned by uid 48 in /home/httpd/vhosts/digitalorthodoxy.com/subdomains/lectionary/httpdocs/wp-admin/admin-functions.php on line 1757
    The uploaded file could not be moved to .

    Error 2.
    Warning: move_uploaded_file(/home/httpd/vhosts/digitalorthodoxy.com/subdomains/blog/httpdocs/wp-content/uploads/2005/12/agentsofchange.jpg): failed to open stream: Permission denied in /home/httpd/vhosts/digitalorthodoxy.com/subdomains/blog/httpdocs/wp-admin/admin-functions.php on line 1757

    Warning: move_uploaded_file(): Unable to move '/tmp/phpSevjR8' to '/home/httpd/vhosts/digitalorthodoxy.com/subdomains/blog/httpdocs/wp-content/uploads/2005/12/agentsofchange.jpg' in /home/httpd/vhosts/digitalorthodoxy.com/subdomains/blog/httpdocs/wp-admin/admin-functions.php on line 1757
    The uploaded file could not be moved to .

    Questions:
    a) does anyone have any ideas how to work with the issue?
    b) is there a plugin that will allow me to run the old upload function?

    Just a note to the crew this is a phenomenal release, well done!

  7. planettelex
    Member
    Posted 8 years ago #

    isn't it always the way?

    type a question after fiddling with it for the last 4 hours and hey presto one little alteration and it all works...

    i've got it working on the other server now! hoorah...

  8. lukiss
    Member
    Posted 8 years ago #

    Curious. So is there a way to get the upload to work if safe mode is used?

  9. windyjon
    Member
    Posted 8 years ago #

    I've just found a way to get around the problem, albeit in a very clunky manual fashion.

    I was having problems with uploading images, the error message kept saying that I needed to check to see if I had write permission to the upload directory, which I did, so I was a bit miffed to find out that actually its all down to the system running in SAFE mode.

    My FTP client wasn't working as I would expect it to, so I resorted to doing it from the command line.

    Basically remove eveything under uploads. (each time you try to upload an image it seems to create corrupted 'year' and 'month' folders without the correct permissions.)
    chmod uploads to 777
    create a directory in uploads called 2006
    chmod this to 777
    create directories in this called 01, 02, 03, 04, 05
    chmod these to 777

    Hey Presto it all seemed to work.

    I'm not sure its safe to chmod everything in sight to 777, but it wouldn't work with anything else.

    J

  10. manstraw
    Member
    Posted 8 years ago #

    just some fyi here. wordpress is creating year and month directories with the apache user as owner and group. it should be creating them for the normal account user. (just ssh in and see what the other files have for ownership). even with permission of 777, if the folder is set to the apache user, safe mode will not let you copy the file into it. This is why creating the year and month structure yourself will work in this event.

  11. pv
    Member
    Posted 7 years ago #

    Thanks windyjon, your solution worked for me! (I'm using godaddy economy linux hosting)

    It would be nice if a future release of WP could fix this. Seems it should be possible to get it to run without safe mode, according to manstraw's comment above.

Topic Closed

This topic has been closed to new replies.

About this Topic