#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    7
    Rep Power
    0
    Hi,

    I have the following problem:

    I've build a PHP script that handles file uploads (images) and writes them to a specified directory.

    I have a telnet account at an ISP with lots of features including MySQL / PHP.

    The problem is: I only get the script work, when I 'chmod 777' the upload directory. The apache server runs under a different user and a different group, so when I want it to write files to my account mode 777 is needed.

    I'm not allowed to use chmod or chgrp commands. Is there a possibility to protect the uploaded files from deletion or whatever under these circumstances?

    Thanks
    BRAM
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 1999
    Location
    New York City
    Posts
    69
    Rep Power
    16
    It comes down to protecting your files from access/deletion etc.

    Here's what I ended up doing to solve that problem once.

    1. Upload the files in PHP to a directory outside of the web server root.
    2. Log the upload into a database, with its location and mime type.
    3. Create a script to open the file and write it to the browser (preceded with its mime type of course).

    Viola! You have a protected download system. You can also have your script require a username and password to protect things even more.


    ------------------
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    76
    Rep Power
    15
    I have a similar problem.

    I am storing file names of images in a mysql database then using php to retrieve the correct image file and display it together with current data to the browser.

    I can do this ok, BUT I would like some way to prevent users copying/saving the image to their own system (ie right click, save image as)

    Is there any way to do this in php so protecting my image files from being copied?

    Many Thanks

    Kevin

  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>Is there any way to do this in php so protecting my image files from being copied?

    Not in PHP but in setting appropriate permission.

    Technically you can protect images from being copied from the web. But practically you wouldn't want to do this because your visitors and yourself can't even view the images (broken) via the web.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    7
    Rep Power
    0
    there is no way to protect from someone coping files via a browser.... i turn javascript off and hope you guys do too.
    so NO you can't keep your stuff from being copied..... (nature of the web kinda stuff) i like FreeBSD's response.

    ccbcreg

    [This message has been edited by ccbcreg (edited November 20, 2000).]

IMN logo majestic logo threadwatch logo seochat tools logo