Uploading file to directories before actually saving them in the correct place.

M

Mufasa

So in our system you can place an order for an item and add photos/files to
the order. So a person decides to attach 3 photos to the order before
submitting the order. Once the order is submitted the files are then saved
in a directory that includes the order number so that they can be easily
found later. Problem is, I don't know the order # until they actually submit
the order. If I create a 'dummy' record before they save it, what happens if
they never save it? I have to write a cleanup that goes through and cleans
up the directories.

Anybody have any clean, elegant solutions to this? I have a feeling I'm just
going to create the order record when they start an order and then cleanup
later the orders that were never finished.

TIA - Jeff.
 
M

Mark Rae [MVP]

Anybody have any clean, elegant solutions to this? I have a feeling I'm
just going to create the order record when they start an order and then
cleanup later the orders that were never finished.

1) In Session_Start, create a folder with the same name as the Session, and
use that folder for any "temporary" files.

2) As required, move the uploaded file(s) into a permanent folder structure.

3) In Session_End, delete the temporary folder.
 
M

Mufasa

Thanks. That looks real promising.

Mark Rae said:
1) In Session_Start, create a folder with the same name as the Session,
and use that folder for any "temporary" files.

2) As required, move the uploaded file(s) into a permanent folder
structure.

3) In Session_End, delete the temporary folder.
 
B

bruce barker

just remember session_end is not reliable (not called with a recycle),
so you will still need cleanup logic. also only inproc sessions support
session_end

-- bruce (sqlwork.com)
Thanks. That looks real promising.
 
M

Mark Rae [MVP]

just remember session_end is not reliable (not called with a recycle), so
you will still need cleanup logic. also only inproc sessions support
session_end

Yes, that's true...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top