SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making an upload script with SAFE MODE in effect.

    I'm trying to make an image upload script, but when i try to use copy() it gives me this:
    Code:
    Warning: SAFE MODE Restriction in effect. The script whose uid is 10119 is not allowed to access
    /var/tmp//phpcgVdJG owned by uid 0
    in /usr/local/plesk/apache/vhosts/3dartisan.net/httpdocs/upload.php on line 32
    Anyone know how i can make this thing work with safe mode on?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't, you will have to turn safe mode off

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, that's not entirely true.
    i sent a help request, and they said i can use move_uploaded_file() to move it from the temp dir, to a folder that i made.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  4. #4
    SitePoint Member Netbuilder's Avatar
    Join Date
    Sep 2001
    Location
    Karlsruhe / Germany
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no, I think this only helps when basedirs are restricted - php-manual tells me, that move_uploaded_file is also restricted in safemode.
    signature

  5. #5
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a Perl script to upload and move it (if possible)

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  6. #6
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    move_uploaded_file() worked just fine with safe mode and open_basdir on and i now have a working script.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  7. #7
    SitePoint Member Netbuilder's Avatar
    Join Date
    Sep 2001
    Location
    Karlsruhe / Germany
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    could I get an example?
    I'm having the same problem.

    # webmaster@netbuilder.org
    signature

  8. #8
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sure:
    PHP Code:
    //note that $uploadedfile is the name of file input field in my form.

    $full_path "/path/to/your/file/";
    $extension ".jpg";
    $spaceless_name str_replace(" ""_"$pic_name); // Remove spaces from filename for naming.
    $file_and_path $full_path $spaceless_name time() . $extension;

    if(
    move_uploaded_file($uploadedfile$file_and_path)){
    echo 
    "Image uploaded successfully";
    } else {
    echo 
    "File upload failed!";

    Last edited by Defender1; Sep 6, 2001 at 03:39.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  9. #9
    SitePoint Member Netbuilder's Avatar
    Join Date
    Sep 2001
    Location
    Karlsruhe / Germany
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool, thanks a lot.
    signature

  10. #10
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure safe mode is on it sounds like they just wont let you use copy() ?

    If safe mode is on you should not be able to upload anything should you?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  11. #11
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's on dude.
    My host told me it is on and how bypass it.
    Unless the message i got above that said safe mode was on means it's not on.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  12. #12
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You said it happens when you use copy()

    Your host might have just blocked this function. Have you tried looking at the results of phpinfo() ?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  13. #13
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    regardless of whether they blocked that function, safe mode is on, and move_uploaded_file works.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •