This is a migrated thread and some comments may be shown as answers.

How to persist data about current file - RadUploadHandler

3 Answers 61 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Patrice VIALOR
Top achievements
Rank 1
Patrice VIALOR asked on 01 Mar 2011, 05:42 PM
Hi,

I'm working on the RadUploadHandler. 
ATM, I have implemented a custom Filename calculation, and folder management following the posts in this forum.

But now, I'm facing another problem :
For a single file, It seem that each time a new chunk of the current file is being uploaded, a new instance of RadUploadHandler is being instantiated.

I'm working on a server-side post-transfer file comparaison, in order to recognize file already uploaded.
From my app point of view, I need to store a same image multiple times (in my DB at least).

So in order to avoir storing the same image N times on the hard drive, I have implemented a post-transfert file-content comparison.

In case of a file upload of an already existing file, this is my scenarion :
- In an overloaded InitializeChunkStorage, based on the filename, I move a possible "identical file" to another filename. At this moment, I want to store multiple informations.
- in an overloaded SaveChunkData, I want to compare the two files (byte to byte comparison), and retrieve the informations stored in the InitializeChunkStorage method.

My problem is, that any information sotred in a CustomRadUploadHandler have disappeared when  I'm in SaveChunkData.

So is there a way to persist informations, in a per-File scope ? (not in a per-upload session).

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Patrice VIALOR
Top achievements
Rank 1
answered on 02 Mar 2011, 10:59 AM
The only solution I found is to store informations with 

public  override void ProcessRequest(System.Web.HttpContext context)
{
context.Session["persistance_test"] = "mydata";
}

BUT two questions still remain :

1) For a single file, the "normal" scenario for the RadUploadHandler is : receive the upload call, start with the firsts chunks, then continue the remaining chunks, then the final one, and then close the file.

Does this scenario can change ? (Does the order of the actions in the above scenario depends on the order of the received TCP packets - and can change if some TCP packet is dropped -, or can I assert that this order will ever be respected ?)

2) If I put the following session state parameters in my webconfig :
<sessionState mode="InProc" cookieless="true" timeout="2" />  (Session timeout = 2 minutes)

In the following cases, does the timeout (the sessionEnd event precisely) will be throwed before the end of the upload :
- If I upload multiple files, and the total upload time is estimated above 2 minutes ?
- If I upload a single file, and the total upload time is estimated above 2 minutes ?


Thanks in advance.
0
Alex Fidanov
Telerik team
answered on 04 Mar 2011, 04:28 PM
Hi Raphaël,

The RadUploadHandler should not receive another chunk, if the previous one was not successfully saved. The RadUpload should send only consecutive chunks to the handler. I am not sure I understood your second question correctly. Could you please elaborate more on the session time out issue?

Best wishes,
Alex Fidanov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Patrice VIALOR
Top achievements
Rank 1
answered on 08 Mar 2011, 04:04 PM
About session time out, I found that the timeout calculated is between consecutives HttpHandler calls.
So the timeout will not be throwed during an upload.

Thanks
Tags
Upload
Asked by
Patrice VIALOR
Top achievements
Rank 1
Answers by
Patrice VIALOR
Top achievements
Rank 1
Alex Fidanov
Telerik team
Share this question
or