Save multiple files in folder and path to database using C# in ASP.Net

Last Reply on Sep 15, 2017 08:13 AM By Andrea

Posted on Sep 15, 2017 08:13 AM

i am working on asp.net web page i have a input type file html control on page i am using jquery to upload multiple images to server and wants to save files to  folder and path to daabase in single column and read it again wehen need

 

upload

my code is here

<style type="text/css">
input[type="file"] {
 
 display:block;
}
.imageThumb {
 height: 100px;
 width: 100px;
 border: 2px solid;
 margin: 5px 5px 0 0;
 padding: 1px;
 }
</style

 

<script type="text/javascript">
    $(document).ready(function () {

        if (window.File && window.FileList && window.FileReader) {
            $("#files").on("change", function (e) {
                var files = e.target.files,
 filesLength = files.length;
                for (var i = 0; i < filesLength; i++) {
                    var f = files[i]
                    var fileReader = new FileReader();
                    fileReader.onload = (function (e) {
                        var file = e.target;
                        $("<img></img>", {
                            class: "imageThumb",
                            src: e.target.result,
                            title: file.name
                        }).insertAfter("#files");
                    });
                    fileReader.readAsDataURL(f);
                }
            });
        } else { alert("Your browser doesn't support to File API") }
    }); 
</script>

 

 <input type="file" id="files" name="files[]" multiple  />

thanks in advance

You are viewing reply posted by: Andrea on Sep 15, 2017 08:13 AM.
Posted on Sep 15, 2017 08:13 AM
Hi @yogeshc,
Please try the following

Save multiple File's FilePath in database table using AJAXFileUpload Control in ASP.Net

It might help you.

Cheers Andrea.