temporary upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chris12295
Forum Contributor
Posts: 113
Joined: Sun Jun 09, 2002 10:28 pm
Location: USA
Contact:

temporary upload

Post by chris12295 »

i am using uniqid() to make a random file name and copy() to place it in a /tmp directory, its an image file, and i want the file to automatically unlink after 5 minutes, is this possible?
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

Post by fractalvibes »

Cannot think of anything efficient...what is it you are trying to accomplish?
Why must the file be copied and then deleted in 5 minutes?

If we know the overall process and how this fits into the process, some better answers might be forthcoming.

Phil J.
chris12295
Forum Contributor
Posts: 113
Joined: Sun Jun 09, 2002 10:28 pm
Location: USA
Contact:

Post by chris12295 »

i have a script that eventually will insert data into a database if a crediat card is succesfully processed. however, the user needs to know his/her information was correct before they pay so i temporarily display all their info inluding pictures. the pictures are not stored in their permanent locations unless the credit card is processed so i need the "PREVIEW" pics to be temporary and delete themselves after 5 minutes to avoid thousands of temporary pics accumulating in my tmp directory.

process:
1. user enters info and selects pics to upload

2. data goes to validation script which shows a confirmation of purchase (inluding all info and a preview of their selected pic which has been copied to the tmp directory)

3. user accepts and form goes to credit card processor (tmp pics deleted after 5 mins)

4. credit card is accepted then data is inserted and pics are permanently copied to user directory.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

if you write your own session handler you may delete temp. data whenever a session is going to be destroyed

http://www.php.net/manual/en/function.s ... andler.php
chris12295
Forum Contributor
Posts: 113
Joined: Sun Jun 09, 2002 10:28 pm
Location: USA
Contact:

Post by chris12295 »

wouldnt that just be for sessions? how could i use this to delete .jpg, .gif, ... files?
Post Reply