Single or multiple UploadHandlers, Stream and noStream controls

Answered (Verified) This post has 1 verified answer | 3 Replies | 3 Followers Thread's RSS feed.

Ognyan Dimitrov
Points 135
Replied On: Thu, Jan 30 2014 9:35 AM Reply

Hi,
I work on C#, .NET 4.5 with Ignite UI 2012.3.
Here is the problem : I have some pages on which the user uploads large files or packets of files - 10-500 MB and some pages on which the user uploads 'logo.png' or some other small files. Thus I have used your implementation in the documentation as basis (Saving Files as Memory Stream by Processing Each Uploaded Chunk of the File Individually) for the page with the large files so I can directly save them to Azure Blob or Local Disk.

It works fine. But this is done also by adding '<add key="FileSaveType" value="memorystream" />' to web.config which rendered unusable my other basic upload controls on other pages. Those I used without registering a handler. ( Have I configured something wrong? )

There is only one option before me and I ask for confirmation and suggestion for best practice : I must register handlers for every control using stream mode. This is not a problem. But I want to know if I can reuse the handlers because I see that the FileUploadingEventArgs e.TemporaryFileName is randomly generated so uploaded files will not step on each others toes.

What is best in this situation? Can I reuse the upload handler methods and register all controls ( by their controlId ) with the same upload handler or I have to make separate instance of the handler methods for every registration? Is there a way to use streamed and not streamed controls in the same project?

If I can reuse the upload handling methods ( FileUploading, FinishingUpload and FinishedUpload ) it will be best.

  • Post Points: 35

Verified Answer

Answered (Verified) Replied On: Tue, Feb 4 2014 11:39 AM Reply
Verified by Ognyan Dimitrov

Hello Hristo,

hristo_guentchev:
It works fine. But this is done also by adding '<add key="FileSaveType" value="memorystream" />' to web.config which rendered unusable my other basic upload controls on other pages. Those I used without registering a handler. ( Have I configured something wrong? )

FileSaveType option is application wide, thus you should stick with saving the files as memory stream for all of your igUpload/WebUpload instances. This is architectural limitation of the control, because it uses one Http Handler and on Http Module for processing the files from all of the control instances. 

hristo_guentchev:
There is only one option before me and I ask for confirmation and suggestion for best practice : I must register handlers for every control using stream mode. This is not a problem. But I want to know if I can reuse the handlers because I see that the FileUploadingEventArgs e.TemporaryFileName is randomly generated so uploaded files will not step on each others toes.

Yes, you should register handlers for all of the control instances. 

hristo_guentchev:
What is best in this situation? Can I reuse the upload handler methods and register all controls ( by their controlId ) with the same upload handler or I have to make separate instance of the handler methods for every registration? Is there a way to use streamed and not streamed controls in the same project?

Yes, you can reuse the handlers. As shown in the Saving Files as Stream (igUpload) topic you should create a static handlers and register them for all of the igUpload/WebUpload controls in the Application_Start method of the Global.asax file.

Hope this helps,
Martin Pavlov
Infragistics, Inc. 

  • Post Points: 40

All Replies

Answered (Verified) Replied On: Tue, Feb 4 2014 11:39 AM Reply
Verified by Ognyan Dimitrov

Hello Hristo,

hristo_guentchev:
It works fine. But this is done also by adding '<add key="FileSaveType" value="memorystream" />' to web.config which rendered unusable my other basic upload controls on other pages. Those I used without registering a handler. ( Have I configured something wrong? )

FileSaveType option is application wide, thus you should stick with saving the files as memory stream for all of your igUpload/WebUpload instances. This is architectural limitation of the control, because it uses one Http Handler and on Http Module for processing the files from all of the control instances. 

hristo_guentchev:
There is only one option before me and I ask for confirmation and suggestion for best practice : I must register handlers for every control using stream mode. This is not a problem. But I want to know if I can reuse the handlers because I see that the FileUploadingEventArgs e.TemporaryFileName is randomly generated so uploaded files will not step on each others toes.

Yes, you should register handlers for all of the control instances. 

hristo_guentchev:
What is best in this situation? Can I reuse the upload handler methods and register all controls ( by their controlId ) with the same upload handler or I have to make separate instance of the handler methods for every registration? Is there a way to use streamed and not streamed controls in the same project?

Yes, you can reuse the handlers. As shown in the Saving Files as Stream (igUpload) topic you should create a static handlers and register them for all of the igUpload/WebUpload controls in the Application_Start method of the Global.asax file.

Hope this helps,
Martin Pavlov
Infragistics, Inc. 

  • Post Points: 40
[Infragistics] Surya
Points 7,499
Infragistics Employee
Replied On: Fri, Feb 7 2014 4:06 PM Reply

Hello Hristo_guentchev,

Please let us know if you have any further questions regarding this matter.

Sincerely,
Prabha
Developer Support Engineer
Infragistics Inc
www.infragistics.com/support

  • Post Points: 5
Ognyan Dimitrov
Points 135
Replied On: Mon, Feb 10 2014 3:29 AM Reply

Because our app is modular - many controllers spread over many web.dlls - the best way will be to register all the handlers from all .web.dlls and then gather them at start-up through the IoC. Thanks for the reply - it cleared the picture for me.

  • Post Points: 5
Page 1 of 1 (4 items) | RSS