'Only one or two files are uploading to server

I am using Dropzone to upload six files in parallel; it works fine locally (localhost). But the same code does not work as expected on QA environment. It uploads one or two files on server when I try to upload six files. I don't understand where is the problem. Here is my code for client side (index.chtml):

    var myDropzone = new Dropzone("#dropzoneJsForm", {
    
            autoProcessQueue: false,
            uploadMultiple: true,
            parallelUploads: 10,
            maxFiles: 6,
            maxFilesize: 3,
            acceptedFiles: ".pdf",
            addRemoveLinks: true,
            init: function () {
             
          
                this.on('sendingmultiple', function (data, xhr, formData) {
                    // this will get sent
                    formData.append('customerID', jQuery('#CustomerId').val());
                    formData.append('RecordId', @Model.Id);
                    formData.append('VIN', jQuery('#TransactionVIN').val());
                    formData.append('DateReceived', jQuery('#CreatedOn').val());
                 });
                this.on("complete", function (file) {
                    if (file.size > 3.0 * 1024 * 1024) {
                        this.removeFile(file);
                        alert('File was Larger than 3.0Mb!');
                        return false;
                    }
    
                    if (!file.type.match('pdf.*')) {
                        this.removeFile(file);
                        alert('Upload PDF Only!')
                        return false;
                    }
                    if (!file.type.match('pdf.*')) {
                        this.removeFile(file);
                        alert('Upload PDF Only!')
                        return false;
                    }
                 
                    if (this.files.length > this.options.maxFiles) {
                        this.removeFile(file);
                        alert('Maximum six files are allowed to upload!')
                        return false;
                    }
                });
                   this.on("queuecomplete", function () {
                    this.options.autoProcessQueue = false;
                });
    
                this.on("processing", function () {
                    this.options.autoProcessQueue = true;
                });
    
            },
            success: function (file, response) {
                var imgName = response;
                file.previewElement.classList.add("dz-success");
    
            },
            error: function (file, response) {
                file.previewElement.classList.add("dz-error");
            }
    
        });
         
        $('#submit-all').click(function (e) {
            e.preventDefault();
            e.stopPropagation();
            showSpinner();
            $('#submit-all').attr('disabled', true);
            $('#submit-cancel').attr('disabled', true);
           if (myDropzone.getQueuedFiles().length > 0) {
                myDropzone.options.autoProcessQueue = true;
                  myDropzone.processQueue();
               }
           else {
               myDropzone.uploadFiles([]);
               $("#dropzoneJsForm").submit();
            }
          
        });
    
    })

Code at Controller:

    foreach (string fileName in request.Files)
    {
    HttpPostedFileBase file = request.Files[fileName];
    
                            fileNames.Add(file.FileName);
                            string _path="";
                            // save file as required here...
                            if (file != null && file.ContentLength > 0)
                            {
    
                                string fName = file.FileName;
                                string extension = fName.Substring(fName.Length - 4);
    
                                string fNameWithoutExtension = fName.Substring(0, fName.Length - 4);
                                fName = fNameWithoutExtension;
                                fNameWithoutExtension = fNameWithoutExtension + strTransactionID + myDateTimeStamp;
                                string newFileName = fNameWithoutExtension + extension;
    
                                 _path = Path.Combine(location, newFileName);
    
                                //Create the directory if it doesn't exist
                                System.IO.FileInfo fileInfo = new System.IO.FileInfo(_path);
                                fileInfo.Directory.Create();
    
                                file.SaveAs(_path);
                                var proxySub = ctx.CustomerDocumentsList.Create();
                                proxySub.CustomerDocumentsId = RecordId;
                                proxySub.UploadedFileName = fName;
                                proxySub.UploadedFileNameWithPath = _path;
                                proxySub.DeleteFlag = 0;
                                ctx.CustomerDocumentsList.Add(proxySub);
                                
                                logger.WriteLog("Record Inserted for: " + fName);
                           
                        }
    
                    }

I have spent a good amount of time but no luck yet. Please assist me and let me know where is problem. Thanks a lot in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source