SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there,
    I am currently trying to create a file upload script for use with my site. I have everything working with regards to actually getting the file up onto the server and into the right directory etc, but every time I upload a file, it's set so that not being a superuser on the server, I can't overwrite it or delete it.

    I've chmodded the destination directory as 777 but that didn't work and using PHP's chmod command after the file is uploaded doesn't work as it is already set so that only a superuser can modify it, so the script dies.

    Any ideas on how to get around this?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well when you upload a fiel to your server the user that runs the web server is the owner f the script, so you should write a script to delete the uploaded files, because it runs as the user that owns the uploaded files. does that make sense?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ie - use <? unlink($filename);?> and 777 is bad ...

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the exact same problem... only the files are owned by "www" and i canīt delete, chmode, or even read them!!

    When i try to use them (link them in a webpage) itīs just like they are not there.

    I canīt even dowload them! When i try to download from Cuteftp, it says file does not exists.

    how to fix this?, is there a way to change the owner of the file (within a php script)?

    Or at least a way of use them (link them from a webpage) (since i know i can write a script to delete them).

    Thanks in advance

  5. #5
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    Alkmaar, Netherlands
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php runs as nobody on the server so when you upload a file its owner is nobody, not you. You can try to run your php upload script as cgi, just place line below on the first line of your script and save as upload.cgi and set chmod 755, hope your host supports it.
    #!/whatever/your/phpis

  6. #6
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know that if your host has safe_mode ON then you have to run the upload script as a CGI because otherwise your script will not be able to access the uploaded file because it is sitting in the temp directory which is outside your document root (www) directory.

  7. #7
    SitePoint Zealot JordanTLClive's Avatar
    Join Date
    Feb 2001
    Location
    Las Vegas, NV
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im having the same problem, what I'm wondering is- is there a way to chmod in php so that at least my scripts could alter a file. What I'm having trouble with is my script uploads a file (an image) and then it tries to use imagemagick to change the image but the permission settings wont let it.
    -Jordan


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
  •