1

I am using fineuploader in partial view which will be appearing multiple times in single page. so there will be multiple instances of fineuploader . Its working fine in IE 10. In IE 7 as described goes to fallback mechanism and show upload button. After click as autoupload is true it uploads file successfully. On serverside I am generating fileId as Guid and returning in Json. As IE 7 doesn't support xhr 2 ; I am not getting onComplete event and json is returned as file is in form of download.

Is there any way i know file upload is complete and get generated fileid back ?

Thanks a lot in advance for help.

here is my code :

function InitializeDragDrop(id, isSingle, oldfiles, fieldId) {


    var itemLimit = isSingle == true ? 1 : 10;

    var restrictedUploader = new qq.FineUploader({
        //debug:true,
        element: document.getElementById(id),
        template: 'qq-template',
        callbacks: {
            onError: function(fileid, name, errorReason, xhr) {
                alert(errorReason);
            },
            onComplete: function(fileid, name, response, xhr) {
                debugger;
                if (response.success != '') {
                    fileid = response.newUuid;
                    addFileToList(fileid, fieldId);
                }
            },
            onDeleteComplete: function(fileid, xhr, isError) {
                if (!isError) {
                    fileid = $.parseJSON('[' + xhr.response + ']')[0].newUuid;
                    removeFileFromList(fileid, fieldId);
                }
            },
            onValidate: function(data, btnName) {
                var filename = data.name;
                var result = $.ajax({
                    type: "GET",
                    url: '../ReferredFieldSelector/CheckDuplicateFileName?fileName=' + filename,
                    async: false
                }).responseText;
                if (result == 'True') {
                    ShowDuplidateFilePopup(filename);
                    return false;
                }
            }
        },
        request: {
            endpoint: '@Url.Action("UploadFiles", "ReferredFieldSelector")',
            params: { fieldId: fieldId }
        },
        validation: {
            itemLimit: itemLimit,
            stopOnFirstInvalidFile: false
        },
        //messages: {
        //    tooManyItemsError : "Too many items ({netItems}) would be uploaded.  Item limit is {itemLimit}.",
        //},
        cors: {
            //all requests are expected to be cross-domain requests
            expected: true,

            //if you want cookies to be sent along with the request
            sendCredentials: true
        },
        deleteFile: {
            enabled: true,
            method: 'POST', // defaults to false
            endpoint: '@Url.Action("DeleteTempararyFiles", "ReferredFieldSelector")'
        }
    });

    if (!(typeof(oldfiles) === 'undefined')) {

        restrictedUploader.addInitialFiles(oldfiles);
    }

};

Update :

I already tried changing content type to "text/plain" as suggested in one of your post.

but it gives me following error

Error IE7

Response I got from server is as below:

HTTP/1.1 200 OK
Cache-Control: private, s-maxage=0
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 25 Oct 2016 20:38:48 GMT
Content-Length: 75

{"success":true,"newUuid":"61bb0f01-e763-4649-b975-20fbc0eefa3d","name":""}

is there any mistake ?

I need newly generated newUuid for clientside processing as I am uploading to server at temporary location and when I finally save main form I move file from temporary to final location for this operation i keep these ids in client side list till user save form.

if i put debugger in events till validation events work fine but after that onSubmit, onComplete , onAllcomplete not firing but file uploaded successfully to server.

0 Answers0