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?
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.
November 20th, 2000, 09:25 AM
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?
November 20th, 2000, 10:50 AM
>>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.
November 20th, 2000, 04:10 PM
so NO you can't keep your stuff from being copied..... (nature of the web kinda stuff) i like FreeBSD's response.
[This message has been edited by ccbcreg (edited November 20, 2000).]