简体   繁体   中英

Dropzone.js: Upload images to server in ASP.NET

I'm using dropzone.js to upload images to the browser. I need to upload these images to the server. Do I need to use Handler.ashx to get the images, and How can I do that? Here is my code

$(document).ready(function (obj) {
    Dropzone.options.myAwesomeDropzone = { // The camelized version of the ID of the form element
        // The configuration we've talked about above
        url: '#',
        previewsContainer: ".dropzone-previews",
        uploadMultiple: true,
        parallelUploads: 100,
        maxFiles: 100,
        dictDefaultMessage: "",
        accept: function(file, done) {
         //in here I can access each file that dropping on to the browser   

            },

        init: function () {
            this.on("drop", function (file) {

            });


            this.on("uploadprogress", function (file, progress) {
                //if (progress == 100) {
                console.log(progress);
                //}
            });
            this.on("maxfilesexceeded", function (file) {
                alert("No more files please!");
            });

            this.on("complete", function (file) {
                if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
                    alert(file.name);
                }
            });
        }

    }

    createDropzone();});

I am new to this area, Any help?

I have done this with mvc.So I didn't need any handler to do this. Uploading file done by using javascript.

Since you are using normal asp.net here is a post that you should refer. You 'll not need any handlers.

https://stackoverflow.com/a/16051735/3156647

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM