//flex table opened by JP

Click to See Complete Forum and Search --> : Can PHP do this?


rraehal
05-23-2007, 12:51 PM
I have written a PHP script. I upload and open a text file and read that file. The contents of the original file are reformatted and a new file is written. I then delete the uploaded file. My user is prompted to download the new file.

All that part of the script works great. I was wondering if there was a way to move the original file. The file is in Q:\Kiosk. Can I move the file on the Q drive from the Kiosk folder to say Q:\Kiosk\Archive using PHP. Perhaps a function similar to move_uploaded_file?

If there is not a built in function, can PHP even move a local file instead of a server file? I always assumed not but thought I would ask. It would prevent me from manually removing or moving the original file. The server can have access to the Q drive if someone is logged in. It could also access the network using a UNC path.

jjinno
05-25-2007, 12:27 PM
If you are referring to the Q drive as a drive on the server then the answer is yes... otherwise the answer is no. Web protocols are just specifically set up to prevent this type of "malicious" file access.

rraehal
05-25-2007, 12:45 PM
That leads to another question. The server can access the Q drive if someone is logged in and the drive is mapped. Would the server then use the credentials of the person logged into the server when the Q drive is accessed?

Would I use the Move Uploaded file function to move the file on drive Q? It seems logical but want to make sure before I start messing with the code of my script. I will try this next week.

rraehal
05-30-2007, 05:16 PM
I successfully have this script moving files on a network path. It took a little while to figure out my problem. My IIS machine is running on a Standalone machine that is part of our AD. The security for the machine when using the web is via user IIS_INTRANET. That user is a local machine account. I changed the anonymous access for IIS to a AD user with a fixed password and granted access to only the \\SERVER\SHARE\KIOSK folder and subfolders and the script works perfectly.

I am using the rename function to move the files. This made it so I do not need to delete anything.

cheap freelancer
06-20-2007, 06:17 AM
You have made your machine more vulnerable to hacking.