|
- function fileQueueError(file, errorCode, message) {
- try {
- if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
- alert("You have attempted to queue too many files.\n" + (message === 0 ? "You have reached the upload limit." : "You may select " + (message > 1 ? "up to " + message + " files." : "one file.")));
- return;
- }
-
- switch (errorCode) {
- case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
- this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
- break;
- case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
- this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
- break;
- case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
- this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
- break;
- default:
-
- this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
- break;
- }
- } catch (ex) {
- this.debug(ex);
- }
- }
-
- function fileDialogComplete(numFilesSelected, numFilesQueued) {
- try {
- this.startUpload();
- } catch (ex) {
- this.debug(ex);
- }
- }
-
- function uploadStart(file) {
- $("#progress").css("display", "block")
- $("input.swfupload_button").remove()
- $("#publish, #save").attr("disabled", "disabled").addClass("disabled")
- }
-
- function uploadProgress(file, bytesLoaded, bytesTotal) {
- try {
- var full_px = $("#progress .back").width()
- var percent = (bytesLoaded / bytesTotal) * full_px;
-
- if (percent == full_px)
- uploadComplete();
-
- $("#progress .fill").css("width", percent)
- } catch (ex) {
- this.debug(ex);
- }
- }
-
- function uploadSuccess(file, serverData) {
- try {
- if (/HEY_JAVASCRIPT_THIS_IS_AN_ERROR_JUST_SO_YOU_KNOW$/m.test(serverData))
- alert(serverData.replace(/(HEY_JAVASCRIPT_THIS_IS_AN_ERROR_JUST_SO_YOU_KNOW|<([^>]+)>\n?)/gm, ""))
- else
- $('<input type="hidden" name="filename" value="'+serverData+'" />').insertAfter("#progress")
- return true;
- } catch (ex) {
- this.debug(ex);
- }
- }
-
- function uploadError(file, errorCode, message) {
- try {
- switch (errorCode) {
- case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
- this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
- break;
- case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
- this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
- break;
- case SWFUpload.UPLOAD_ERROR.IO_ERROR:
- this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
- break;
- case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
- this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
- break;
- case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
- this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
- break;
- case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
- this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
- break;
- case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
- break;
- case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
- break;
- default:
- this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
- break;
- }
- } catch (ex) {
- this.debug(ex);
- }
- }
-
- function uploadComplete(file) {
- $("#progress").addClass("done")
- $("#publish, #save").removeAttr("disabled").removeClass("disabled")
- }
|