Search code examples
asp.net-mvcfile-uploadkendo-uijquery-file-uploadkendo-upload

How to save multiple files to database rather than disk


I tried to apply the method on this page, but this sample save the files to disk instead of Database. So, could you please inform me what changes should be made on the sample method or is there any sample using this Kendo Upload to save multiple files to database?


Solution

  • The following method declaration -

    private IEnumerable<string> GetFileInfo(IEnumerable<HttpPostedFileBase> files)
    

    which receives the uploaded files have IEnumerable<HttpPostedFileBase> as parameter. It is collection of all the uploaded files. Each file exposes a property InputStream. For more information visit this msdn page

    So now that you have the file content in form of stream, convert this stream into byte[] and save this to database. Some suggestion are posted here.