|
1 | 1 | /* |
2 | | - * jQuery File Upload User Interface Plugin 6.9.3 |
| 2 | + * jQuery File Upload User Interface Plugin 6.9.4 |
3 | 3 | * https://github.com/blueimp/jQuery-File-Upload |
4 | 4 | * |
5 | 5 | * Copyright 2010, Sebastian Tschan |
|
89 | 89 | files = data.files; |
90 | 90 | $(this).fileupload('process', data).done(function () { |
91 | 91 | that._adjustMaxNumberOfFiles(-files.length); |
92 | | - data.isAdjusted = true; |
| 92 | + data.maxNumberOfFilesAdjusted = true; |
93 | 93 | data.files.valid = data.isValidated = that._validate(files); |
94 | 94 | data.context = that._renderUpload(files).data('data', data); |
95 | 95 | options.filesContainer[ |
|
112 | 112 | send: function (e, data) { |
113 | 113 | var that = $(this).data('fileupload'); |
114 | 114 | if (!data.isValidated) { |
115 | | - if (!data.isAdjusted) { |
| 115 | + if (!data.maxNumberOfFilesAdjusted) { |
116 | 116 | that._adjustMaxNumberOfFiles(-data.files.length); |
| 117 | + data.maxNumberOfFilesAdjusted = true; |
117 | 118 | } |
118 | 119 | if (!that._validate(data.files)) { |
119 | 120 | return false; |
|
163 | 164 | ); |
164 | 165 | }); |
165 | 166 | } else { |
| 167 | + if ($.isArray(data.result)) { |
| 168 | + $.each(data.result, function (index, file) { |
| 169 | + if (data.maxNumberOfFilesAdjusted && file.error) { |
| 170 | + that._adjustMaxNumberOfFiles(1); |
| 171 | + } else if (!data.maxNumberOfFilesAdjusted && |
| 172 | + !file.error) { |
| 173 | + that._adjustMaxNumberOfFiles(-1); |
| 174 | + } |
| 175 | + }); |
| 176 | + data.maxNumberOfFilesAdjusted = true; |
| 177 | + } |
166 | 178 | template = that._renderDownload(data.result) |
167 | 179 | .appendTo(that.options.filesContainer); |
168 | 180 | that._forceReflow(template); |
|
178 | 190 | fail: function (e, data) { |
179 | 191 | var that = $(this).data('fileupload'), |
180 | 192 | template; |
181 | | - that._adjustMaxNumberOfFiles(data.files.length); |
| 193 | + if (data.maxNumberOfFilesAdjusted) { |
| 194 | + that._adjustMaxNumberOfFiles(data.files.length); |
| 195 | + } |
182 | 196 | if (data.context) { |
183 | 197 | data.context.each(function (index) { |
184 | 198 | if (data.errorThrown !== 'abort') { |
|
209 | 223 | } |
210 | 224 | }); |
211 | 225 | } else if (data.errorThrown !== 'abort') { |
212 | | - that._adjustMaxNumberOfFiles(-data.files.length); |
213 | 226 | data.context = that._renderUpload(data.files) |
214 | 227 | .appendTo(that.options.filesContainer) |
215 | 228 | .data('data', data); |
|
0 commit comments