1 | function webtvuploadSuccess(file, serverData) {
|
---|
2 | try {
|
---|
3 | if (serverData == "sucess") {
|
---|
4 | document.getElementById('eleList').innerHTML = '<span style="color: #009015;">uploaded</span><span style="color: #6F6F6F;"> ' + file.name + ' '+ file.size + '</span>';
|
---|
5 | document.getElementById('uploaddiv').innerHTML = 'Video Uploaded';
|
---|
6 | } else {
|
---|
7 | document.getElementById('webtv-status-upload').innerHTML = '<span style="color: #FF0000;">error</span><span style="color: #6F6F6F;"> ' + serverData + '</span>';
|
---|
8 | }
|
---|
9 |
|
---|
10 | } catch (ex) {
|
---|
11 | this.debug(ex);
|
---|
12 | }
|
---|
13 | }
|
---|
14 |
|
---|
15 | function webtvfileDialogComplete(numFilesSelected, numFilesQueued) {
|
---|
16 | try {
|
---|
17 | if (numFilesSelected > 0) {
|
---|
18 | //document.getElementById(this.customSettings.cancelButtonId).disabled = false;
|
---|
19 | }
|
---|
20 |
|
---|
21 | /* I want auto start the upload and I can do that here */
|
---|
22 | this.startUpload();
|
---|
23 | } catch (ex) {
|
---|
24 | this.debug(ex);
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | function webtvuploadStart(file) {
|
---|
29 | try {
|
---|
30 | document.getElementById('webtv-status-upload').innerHTML = "Uploading";
|
---|
31 | /*var progress = new FileProgress(file, this.customSettings.progressTarget);
|
---|
32 | progress.setStatus("Uploading...");
|
---|
33 | progress.toggleCancel(true, this);*/
|
---|
34 | }
|
---|
35 | catch (ex) {}
|
---|
36 |
|
---|
37 | return true;
|
---|
38 | }
|
---|
39 |
|
---|
40 | function webtvuploadProgress(file, bytesLoaded, bytesTotal) {
|
---|
41 | try {
|
---|
42 | var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
|
---|
43 | var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];
|
---|
44 | var e = Math.floor(Math.log(bytesTotal)/Math.log(1024));
|
---|
45 | var sizeTotal = (bytesTotal/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
|
---|
46 |
|
---|
47 | document.getElementById('webtv-status-upload').innerHTML = percent + "% of "+ sizeTotal;
|
---|
48 |
|
---|
49 | /*var progress = new FileProgress(file, this.customSettings.progressTarget);
|
---|
50 | progress.setProgress(percent);
|
---|
51 | progress.setStatus("Uploading...");*/
|
---|
52 | } catch (ex) {
|
---|
53 | this.debug(ex);
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | function webtvuploadError(file, errorCode, message) {
|
---|
58 | try {
|
---|
59 |
|
---|
60 | switch (errorCode) {
|
---|
61 | case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
|
---|
62 | document.getElementById('webtv-status-upload').innerHTML = "Upload Error: " + message;
|
---|
63 | this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
|
---|
64 | break;
|
---|
65 | case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
|
---|
66 | document.getElementById('webtv-status-upload').innerHTML = "Upload Failed.";
|
---|
67 | this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
---|
68 | break;
|
---|
69 | case SWFUpload.UPLOAD_ERROR.IO_ERROR:
|
---|
70 | document.getElementById('webtv-status-upload').innerHTML = "Server (IO) Error";
|
---|
71 | this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
|
---|
72 | break;
|
---|
73 | case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
|
---|
74 | document.getElementById('webtv-status-upload').innerHTML = "Security Error";
|
---|
75 | this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
|
---|
76 | break;
|
---|
77 | case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
|
---|
78 | document.getElementById('webtv-status-upload').innerHTML = "Upload limit exceeded.";
|
---|
79 | this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
---|
80 | break;
|
---|
81 | case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
|
---|
82 | document.getElementById('webtv-status-upload').innerHTML = "Failed Validation. Upload skipped.";
|
---|
83 | this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
---|
84 | break;
|
---|
85 | case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
|
---|
86 | // If there aren't any files left (they were all cancelled) disable the cancel button
|
---|
87 | if (this.getStats().files_queued === 0) {
|
---|
88 | //document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
---|
89 | }
|
---|
90 | document.getElementById('webtv-status-upload').innerHTML = "Cancelled";
|
---|
91 | //progress.setCancelled();
|
---|
92 | break;
|
---|
93 | case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
|
---|
94 | document.getElementById('webtv-status-upload').innerHTML = "Stopped";
|
---|
95 | break;
|
---|
96 | default:
|
---|
97 | document.getElementById('webtv-status-upload').innerHTML = "Unhandled Error: " + errorCode;
|
---|
98 | this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
---|
99 | break;
|
---|
100 | }
|
---|
101 | } catch (ex) {
|
---|
102 | this.debug(ex);
|
---|
103 | }
|
---|
104 | }
|
---|
105 |
|
---|
106 | function submit_form_upload() {
|
---|
107 | document.forms['post'].submit();
|
---|
108 | }
|
---|
109 |
|
---|
110 | function webtvuploadComplete(file) {
|
---|
111 | if (this.getStats().files_queued === 0) {
|
---|
112 | //document.getElementById('uploaddiv').innerHTML = '<span id="spanButtonPlaceHolder"><a href="#webtv-status-info" onclick="submit_form_upload()">Retry Upload</a></span>';
|
---|
113 | //document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
---|
114 | }
|
---|
115 | }
|
---|