Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
Upload multiple files into SQL - vb.net and Asp.net
posted

Hola,

I need to upload a multiple files into SQL database as Varbinary, with the ASP.net Upload file, I'm using the following code, how can I do it with the Infragistics upload file?

                Dim img As FileUpload = CType(ASPFileUpload, FileUpload)

                Dim imgByte As Byte() = Nothing
                If img.HasFile AndAlso Not img.PostedFile Is Nothing Then

                    'To create a PostedFile
                    Dim File As HttpPostedFile = ASPFileUpload.PostedFile

                    'Create byte Array with file len
                    imgByte = New Byte(File.ContentLength - 1) {}

                    'force the control to load data in array
                    File.InputStream.Read(imgByte, 0, File.ContentLength)
                    cmd.Parameters.AddWithValue("@vtype", Path.GetExtension(ASPFileUpload.FileName).ToLower)
                    cmd.Parameters.AddWithValue("@vatt", imgByte)
                End If
Parents
No Data
Reply
  • 1700
    Offline posted

    Hello,

    I have prepared a small sample application which demonstrates the use of the WebUpload control. Please note that in order to use the WebUpload you would need some additional configuration, which involves the addition of some css and javascript files required for the use of Ignite UI for JQuery, which is mandatory for the use of the WebUpload. You would also need to add some appSettings as well as some system.webServer configurations in the web.config file. To learn more about this please review the following page.

    Once a file is uploaded the OnUploadFinished could be used to obtain different details for the file, such as FileName, FolderPath, FileSize etc. These properties could be used for the file operations similar to how you are using the native ASP FileUpload.

    You can find the link for the sample here.

    Please let me know if you have any questions.

    Regards,
    Ivan Kitanov

Children
No Data