10 Answers, 1 is accepted
It is possible to directly upload files to the database without using the temporary upload folder. For this requirement do not set TemporaryFolder property and set the DisableChunkUpload property to true. Then the files can be directly saved to the DB using a Custom Http Handler. Please have a look into the full code I tried which worked fine at my end.
C# : (Handler.ASHX)
I tried your code, and it does not work. But I am not familiar with http handlers. Is anything to do that the handler works (web.config ?)
I create a new generic handler with vs 12. Paste the code and uncomment the default class "Handler1"
But the function (Process) you wrote was not called. If I uncomment the default class, the “ProcessRequest” was called.
What’ wrong / missing?
There is no need to add any additional settings in the web.config for the Http handler to work. Please note that the class names in the handler should be the same.
Hope this helps,
thanks for your response!
In the meantime I found an complete example in Telerics Demo site with code something to learn. And it works :-)
But, you’re right there was a different between the ashx and ashx.vb class name.
I was following the code you posted in this thread to avoid the use of temporary folder. when i tested things are working good but contrary to what you described the temp folder with RadUploadTest is created in app_data but at the same time the uploaded file is available in the http context object. Creating a temp folder and moving file to context object seems confusing. Is this some sort of bug?
This is the expected behavior of the control and not a bug. Even if you use any HTTP handler to upload files directly to the target, the control by design always create a TemporaryFolder to verify if it has write permissions on the File System. The Temporary folder will be created but files wont be transferred there. Instead the uploaded file will be available in the HTTP context object of the handler as you mentioned.
If you would like to have such a functionality that allow the user to determine whether the TemporaryFolder will be created or not, you can submit a new feature request.
Hope this helps,
I don't get it how you consider this a feature and not a bug... There are bunch of behavior properties in this control like EnablePermissionsCheck, UseApplicationPoolImpersonation, DisableChunkUpload which together with HttpHandlerUrl lead you to the ideea that this control can be used without the temp folder. But you there is one small detail...onPreRender you forgot to drop the call for TestTemporaryFolderPermissions method. Isn't stupid to check for some permissions when you don't need to check them?
From Q1 2013 Telerik introduces a property called EnablePermissionsCheck, by default its value is true if you don't want to check the permission set it as false.
i want to upload files to database directly instead of temp folder. the reason is that i found that file uploaded and then to move to database takes long time.
im currently trying for entity framework. hwo to accomplish this and then how ot retrieve it? any idea?
You need to create a custom handler and set the EnablePermissionsCheck = false and DisableChunkUpload = true. When the Process method in the Handler is overridden you should not call the base method (it saves the file into the temporary folder).