Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mufasa - 30 Aug 2007 18:59 GMT
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.
Mark Rae [MVP] - 30 Aug 2007 19:12 GMT
> 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.

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Mufasa - 30 Aug 2007 22:31 GMT
Thanks. That looks real promising.

>> 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
[quoted text clipped - 7 lines]
>
> 3) In Session_End, delete the temporary folder.
bruce barker - 30 Aug 2007 23:27 GMT
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.
>
[quoted text clipped - 8 lines]
>>
>> 3) In Session_End, delete the temporary folder.
Mark Rae [MVP] - 30 Aug 2007 23:50 GMT
> 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...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.