file.js revision fcdde054cb9ae4ad0a9c7137519a1bc0be9f471d
/**
* The File class provides a wrapper for a file pointer, either through an HTML5
* implementation or as a reference to a file pointer stored in Flash. The File wrapper
* also implements the mechanics for uploading a file and tracking its progress.
* @module File
*/
/**
* The class provides a wrapper for a file pointer.
* @class File
* @extends Base
* @constructor
*/
var YFile = function(o) {
var file = null;
if (Y.File.isValidFile(o)) {
file = o;
}
}
if (!this.get("file")) {
}
if (!this.get("html5")) {
this._set("html5", true);
}
if (!this.get("name")) {
}
}
if (!this.get("type")) {
}
}
}
};
initializer : function (cfg) {
if (!this.get("id")) {
}
},
_uploadEventHandler: function (event) {
case "progress":
});
break;
case "load":
this._set("xhr", null);
break;
case "error":
break;
case "abort":
break;
case "readystatechange":
originEvent: event});
break;
}
},
/**
* Starts the upload of a specific file.
*
* @method startUpload
* @param url {String} The URL to upload the file to.
* @param parameters {Object} (optional) A set of key-value pairs to send as variables along with the file upload HTTP request.
* @param fileFieldName {String} (optional) The name of the POST variable that should contain the uploaded file ('Filedata' by default)
* @return {Boolean} This method always returns true.
*/
if (this.get("html5")) {
//console.log ("Initializing xhr");
var uploadData = new FormData(),
// console.log ("Appending data to xhr");
// console.log ("Adding event listeners");
// console.log ("Initiating upload");
// console.log(xhr);
}
},
/**
* Cancels the upload of a specific file, if currently in progress.
*
* @method cancelUpload
*/
cancelUpload: function () {
},
}, {
NAME: 'file',
ATTRS: {
html5: {
readOnly: true,
value: false
},
id: {
writeOnce: "initOnly",
value: null
},
size: {
writeOnce: "initOnly",
value: 0
},
name: {
writeOnce: "initOnly",
value: null
},
dateCreated: {
writeOnce: "initOnly",
value: null
},
dateModified: {
writeOnce: "initOnly",
value: null
},
readOnly: true,
value: 0
},
type: {
writeOnce: "initOnly",
value: null
},
file: {
writeOnce: "initOnly",
value: null
},
uploader: {
writeOnce: "initOnly",
value: null
},
xhr: {
readOnly: true,
value: null
},
readOnly: true,
value: null
}
},
/**
* Checks whether a specific native file instance is valid
*
* @method isValidFile
* @param file {File} A native File() instance.
*/
isValidFile: function (file) {
},
/**
* Checks whether the browser has a native upload capability
* via XMLHttpRequest Level 2.
*
* @method canUpload
*/
canUpload: function () {
},
FOO: "BAR"
});