BVB Source Codes

Ali cloud storage v1.1 PHP file upload system root directory Show handlers.js Source code

Return Download Ali cloud storage v1.1 PHP file upload system root directory: download handlers.js Source code - Download Ali cloud storage v1.1 PHP file upload system root directory Source code - Type:.js
  1. function swfUploadLoaded() {
  2.         // pass
  3. }
  4.  
  5. // Called by the queue complete handler to submit the form
  6. function uploadDone() {
  7.         try {
  8.                 // pass
  9.         } catch (ex) {
  10.                 alert("Error submitting form");
  11.         }
  12. }
  13.  
  14. function fileDialogStart() {
  15.         var txtFileName = document.getElementById("FileInput");
  16.         txtFileName.value = "";
  17.         this.cancelUpload();
  18. }
  19.  
  20.  
  21.  
  22. function fileQueueError(file, errorCode, message)  {
  23.         try {
  24.                 // Handle this error separately because we don't want to create a FileProgress element for it.
  25.                 switch (errorCode) {
  26.                 case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
  27.                         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.")));
  28.                         return;
  29.                 case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
  30.                         alert("The file you selected is too big.");
  31.                         this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
  32.                         return;
  33.                 case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
  34.                         alert("The file you selected is empty.  Please select another file.");
  35.                         this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
  36.                         return;
  37.                 case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
  38.                         alert("The file you choose is not an allowed file type.");
  39.                         this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
  40.                         return;
  41.                 default:
  42.                         alert("An error occurred in the upload. Try again later.");
  43.                         this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
  44.                         return;
  45.                 }
  46.         } catch (e) {
  47.         }
  48. }
  49.  
  50. function fileQueued(file) {
  51.         try {
  52.                 var txtFileName = document.getElementById("FileInput");
  53.                 txtFileName.value = file.name;
  54.         } catch (e) {
  55.         }
  56.  
  57. }
  58. function fileDialogComplete(numFilesSelected, numFilesQueued) {
  59.         // pass
  60. }
  61.  
  62. function uploadProgress(file, bytesLoaded, bytesTotal) {
  63.  
  64.         try {
  65.                 var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
  66.  
  67.                 file.id = "singlefile"; // This makes it so FileProgress only makes a single UI element, instead of one for each file
  68.                 var progress = new FileProgress(file, this.customSettings.progress_target);
  69.                 progress.setProgress(percent);
  70.                 progress.setStatus("上传中...");
  71.                 $("#s3_url").val("上传中. 请等待...");
  72.         } catch (e) {
  73.         }
  74. }
  75.  
  76. function uploadSuccess(file, serverData) {
  77.         try {
  78.                 file.id = "singlefile"; // This makes it so FileProgress only makes a single UI element, instead of one for each file
  79.                 var progress = new FileProgress(file, this.customSettings.progress_target);
  80.                 progress.setComplete();
  81.                 progress.setStatus("完成.");
  82.                 progress.toggleCancel(false);
  83.                
  84.                 if (serverData === " ") {
  85.                         this.customSettings.upload_successful = false;
  86.                 } else {
  87.                         this.customSettings.upload_successful = true;
  88.                         document.getElementById("s3_url").value = serverData;
  89.                         $("#s3_url").focus();
  90.                 }
  91.                
  92.         } catch (e) {
  93.         }
  94. }
  95.  
  96. function uploadComplete(file) {
  97.         try {
  98.                 if (this.customSettings.upload_successful) {
  99.                         this.setButtonDisabled(true);
  100.                         uploadDone();
  101.                 } else {
  102.                         file.id = "singlefile"; // This makes it so FileProgress only makes a single UI element, instead of one for each file
  103.                         var progress = new FileProgress(file, this.customSettings.progress_target);
  104.                         progress.setError();
  105.                         progress.setStatus("File rejected");
  106.                         progress.toggleCancel(false);
  107.                        
  108.                         var txtFileName = document.getElementById("txtFileName");
  109.                         txtFileName.value = "";
  110.  
  111.                         alert("There was a problem with the upload.\nThe server did not accept it.");
  112.                 }
  113.         } catch (e) {
  114.         }
  115. }
  116.  
  117. function uploadError(file, errorCode, message) {
  118.         try {
  119.                
  120.                 if (errorCode === SWFUpload.UPLOAD_ERROR.FILE_CANCELLED) {
  121.                         // Don't show cancelled error boxes
  122.                         return;
  123.                 }
  124.                
  125.                 var txtFileName = document.getElementById("txtFileName");
  126.                 txtFileName.value = "";
  127.                
  128.                 // Handle this error separately because we don't want to create a FileProgress element for it.
  129.                 switch (errorCode) {
  130.                 case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
  131.                         alert("There was a configuration error.  You will not be able to upload a resume at this time.");
  132.                         this.debug("Error Code: No backend file, File name: " + file.name + ", Message: " + message);
  133.                         return;
  134.                 case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
  135.                         alert("You may only upload 1 file.");
  136.                         this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
  137.                         return;
  138.                 case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
  139.                 case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
  140.                         break;
  141.                 default:
  142.                         alert("An error occurred in the upload. Try again later.");
  143.                         this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
  144.                         return;
  145.                 }
  146.  
  147.                 file.id = "singlefile"; // This makes it so FileProgress only makes a single UI element, instead of one for each file
  148.                 var progress = new FileProgress(file, this.customSettings.progress_target);
  149.                 progress.setError();
  150.                 progress.toggleCancel(false);
  151.  
  152.                 switch (errorCode) {
  153.                 case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
  154.                         progress.setStatus("Upload Error");
  155.                         this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
  156.                         break;
  157.                 case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
  158.                         progress.setStatus("Upload Failed.");
  159.                         this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
  160.                         break;
  161.                 case SWFUpload.UPLOAD_ERROR.IO_ERROR:
  162.                         progress.setStatus("Server (IO) Error");
  163.                         this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
  164.                         break;
  165.                 case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
  166.                         progress.setStatus("Security Error");
  167.                         this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
  168.                         break;
  169.                 case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
  170.                         progress.setStatus("Upload Cancelled");
  171.                         this.debug("Error Code: Upload Cancelled, File name: " + file.name + ", Message: " + message);
  172.                         break;
  173.                 case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
  174.                         progress.setStatus("Upload Stopped");
  175.                         this.debug("Error Code: Upload Stopped, File name: " + file.name + ", Message: " + message);
  176.                         break;
  177.                 }
  178.         } catch (ex) {
  179.         }
  180. }
  181.  
  182. /**
  183. Main upload handler
  184. **/
  185. $(function(){
  186.         $("#s3_upload_form").live('submit', function(e){
  187.                 isValid = true;
  188.                 FileInput = $("#FileInput").val();
  189.                 error_msg = "";
  190.                 if(FileInput =="" || FileInput == "No file selected"){
  191.                         error_msg += "\tPlease select a file to upload\n";
  192.                         isValid = false;
  193.                 }
  194.                
  195.                 if(isValid===false){
  196.                         alert(error_msg);
  197.                 } else { // valid
  198.                         swfu_s3.addPostParam("bucket_name", $("#bucket_name").find("option:selected").val());
  199.                         swfu_s3.addPostParam("perm", $('input[name=perm]:checked', '#s3_upload_form').val());
  200.                         swfu_s3.startUpload();
  201.                 }
  202.                 e.preventDefault();
  203.         });
  204.        
  205.         $(".reload").click(function(){
  206.                 window.location.href=window.location.href; // reload page
  207.                 return false;
  208.         });
  209. });
downloadhandlers.js Source code - Download Ali cloud storage v1.1 PHP file upload system root directory Source code
Related Source Codes/Software:
Qr code generation V1.1 online - Directions for use: 2016-10-23
Short url program V1.2 (with black and white list function) - This short url program has three features: 2016-10-22
V2.0 Openbiz Cubi PHP rapid development platform - Openbiz Cubi is a PHP-based open source rapid appl... 2016-10-22
At half past eight self-help chain utf-8 v1.0 - Installation instructions After downloading befor... 2016-10-22
New Yorker rat taobao station group management system v2.0 - Rats off Amoy Taobao station management system 2.0... 2016-10-22
Desert arashi v0.1.2 file operations procedures - Desert arashi file operations procedures is a simp... 2016-10-23
Good business mall v2.0 open source edition - Good business, open source shopping mall, which is... 2016-10-23
Easy website system v2.0 - Business easy built station system (Sunnyi Website... 2016-10-23
Emlog for SAE v4.2.1 - Emlog for SAE is suitable for SAE emlog used modif... 2016-10-23
Food science and technology chain edition v1.1 online reservation system - Treat chain version of the main functions of the o... 2016-10-23
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top