PDA

View Full Version : Writing Files using PHP & No chmoding to 777


outline
11-14-2000, 03:07 PM
I am trying to write a script that will allow a user to upload a file, and have that file stored on the filesystem in a certain directory.

Here's what I do not want to do:
1. CHMOD the directory to 777
2. CHMOD the directory to be the user/group of APACHE

Does anyone have any ideas?[nbsp][nbsp]I thought about connecting via FTP from PHP, but PHP's FTP won't let you remove files, only open them.

I also thought about using the exec() command from PHP, but am not sure how I could do that and remove the file from the system so that ftp could come and place the file on there.

The ideal solution would be independant of FTP, and would allow me to switch user and group based on some predefined variables, then login, and overwrite the file with the new one.[nbsp][nbsp]Can this be done?[nbsp][nbsp]If not in PHP, then in PERL?[nbsp][nbsp]

Many thanks!!

Brian
11-14-2000, 03:22 PM
You might want to check out the following link on Aota.net

http://www.aota.net/PHP_and_MySQL/phpupload.php3

-Brian

outline
11-14-2000, 03:27 PM
Ok, well that answers my question about PHP.. Basically I can't use it.[nbsp][nbsp]Can anyone direct me to some information on how I can use PERL to upload the files instead?

Thanks!
Paul

jbroder
11-16-2000, 10:41 PM
there are lots of free perl scripts that upload files. I would try cgi-resources.