Pending Review
Last Updated: 03 May 2019 20:33 by Adam
Created on: 02 Oct 2018 12:31
Category: AsyncUpload
Type: Feature Request
radasyncupload add SQL filestream support
I would be nice to gain more control over radasyncupload's upload behavior when using database as storage for uploaded files.

Consider this use case. You have file management web-app that uses SQL database as storage for uploaded files. In SQL database you use Filestream enabled table to store the uploaded file data. You like to allow your app users to upload multiple big files > 100 Mt at once. And you have limited disc space on your web server hosting your app. So you don't want to buffer those uploaded files on your web server in any point of the upload process.

To be able to do so radasyncupload needs to be able to stream uploaded files to the SQL database as straight as possible. Chunk by chunk. 

radasyncupload already has feature that allows you to use your own generic handler to handle some of the upload process. It just needs expose some of those events that happens before process-event (maybe ProcessRequest?). So developer can start handling the HttpPostedFile's InputStream at the begining of the upload and stream it directly to the database. Like one can do with the regular upload controls like so:

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

	Dim hpf As HttpPostedFile
	For i = 0 To context.Request.Files.Count - 1
		hpf = context.Request.Files.Item(i)
		Using Command As SqlCommand = New SqlCommand(String.Concat("INSERT INTO Dokuments(DokumData...) values (@DokumData...)"), connection)
		'Other params

		Command.Parameters.Add("@DokumData", SqlDbType.Binary, -1).Value = hpf.InputStream

End Sub
1 comment
Posted on: 03 May 2019 20:33
Great suggestion.  It would be nice to avoid having to put the file(s) in a temporary location before it gets streamed into the DB.