|
Lines 198-203
Link Here
|
| 198 |
reader.onprogress = fnUpdateProgress; |
198 |
reader.onprogress = fnUpdateProgress; |
| 199 |
reader.onabort = function(e) { |
199 |
reader.onabort = function(e) { |
| 200 |
alert('File read cancelled'); |
200 |
alert('File read cancelled'); |
|
|
201 |
parent.location='quotes-upload.pl'; |
| 201 |
}; |
202 |
}; |
| 202 |
reader.onloadstart = function(e) { |
203 |
reader.onloadstart = function(e) { |
| 203 |
document.getElementById('cancel_upload').style.visibility="visible"; |
204 |
document.getElementById('cancel_upload').style.visibility="visible"; |
|
Lines 211-216
Link Here
|
| 211 |
quotes = fnCSVToArray(e.target.result, ','); |
212 |
quotes = fnCSVToArray(e.target.result, ','); |
| 212 |
fnDataTable(quotes); |
213 |
fnDataTable(quotes); |
| 213 |
} |
214 |
} |
|
|
215 |
|
| 216 |
// perform various sanity checks on the target file prior to uploading... |
| 217 |
var fileType = evt.target.files[0].type || 'unknown'; |
| 218 |
var fileSizeInK = Math.round(evt.target.files[0].size/1024); |
| 219 |
|
| 220 |
if (fileType != 'text/csv') { |
| 221 |
alert('Incorrect filetype: '+fileType+'. Uploads limited to text/csv.'); |
| 222 |
parent.location='quotes-upload.pl'; |
| 223 |
return; |
| 224 |
} |
| 225 |
if (fileSizeInK > 512) { |
| 226 |
if (!confirm(evt.target.files[0].name+' is '+fileSizeInK+' K in size. Do you really want to upload this file?')) { |
| 227 |
parent.location='quotes-upload.pl'; |
| 228 |
return; |
| 229 |
} |
| 230 |
} |
| 214 |
// Read in the image file as a text string. |
231 |
// Read in the image file as a text string. |
| 215 |
reader.readAsText(evt.target.files[0]); |
232 |
reader.readAsText(evt.target.files[0]); |
| 216 |
} |
233 |
} |
| 217 |
- |
|
|