@@ -67,9 +67,9 @@ module.exports = function(AV) {
6767 * @param data {Array} The data for the file, as either:
6868 * 1. an Array of byte value Numbers, or
6969 * 2. an Object like { base64: "..." } with a base64-encoded String.
70- * 3. a File object selected with a file upload control. (3) only works
71- * in Firefox 3.6+, Safari 6.0.2+, Chrome 7+, and IE 10+ .
72- * 4.a Buffer object in Node.js runtime.
70+ * 3. a Blob( File) selected with a file upload control.
71+ * 4. a Buffer in Node.js runtime .
72+ * 5. a Stream in Node.js runtime.
7373 *
7474 * For example:<pre>
7575 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
@@ -109,6 +109,7 @@ module.exports = function(AV) {
109109
110110 this . _extName = '' ;
111111 this . _data = data ;
112+ this . _uploadHeaders = { } ;
112113
113114 if ( process . env . CLIENT_PLATFORM === 'ReactNative' || process . env . CLIENT_PLATFORM === 'Weapp' ) {
114115 if ( data && data . blob ) {
@@ -333,6 +334,19 @@ module.exports = function(AV) {
333334 }
334335 } ,
335336
337+ /**
338+ * Set a header for the upload request.
339+ * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
340+ *
341+ * @param {String } key header key
342+ * @param {String } value header value
343+ * @return {AV.File } this
344+ */
345+ setUploadHeader ( key , value ) {
346+ this . _uploadHeaders [ key ] = value ;
347+ return this ;
348+ } ,
349+
336350 /**
337351 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
338352 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
0 commit comments