查看JS File对象 所有属性 如何获得file的data数据
js file对象 如何获得对应的data数据
<input id="uploaderCustomInput" type="file" accept="image/*" multiple="multiple" onChange={this.handleFileChange} />
handleFileChange(e) {
console.log(`handleFileChange:`);
console.log(e);
console.log(e.target);
console.log(e.target.files);
}
打印出来File的一些基本信息
FileList {0: File, length: 1}
length:1
0:File
lastModified:1501579781000
lastModifiedDate:Tue Aug 01 2017 17:29:41 GMT+0800 (CST)
name:"cow_4.jpg"
size:271136
type:"image/jpeg"
webkitRelativePath:""
__proto__:File
__proto__:FileList
但是需要知道其 更多的 关于js中的file的信息
html file object in javascript
File – Web APIs | MDN
以为file中的data数据是来自blob中:
Blob – Web APIs | MDN
Using files from web applications | MDN
Example: Showing thumbnails of user-selected images
How to instantiate a File object in JavaScript? – Stack Overflow
总结
js中的file的对象的属性有:
Properties
The File interface also inherits properties from the Blob interface:
File.lastModified Read only
Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight).
File.lastModifiedDate Read only
Returns the last modified Date of the file referenced by the File object.
File.name Read only
Returns the name of the file referenced by the File object.
File.size Read only
Returns the size of the file.
File.webkitRelativePath Read only
Returns the path the URL of the File is relative to.
File.type Read only
Returns the MIME type of the file.
然后想要获得file的data 则可以通过file集成自Blob的:
A File object is a specific kind of a Blob, and can be used in any context that a Blob can. In particular, FileReader, URL.createObjectURL(), createImageBitmap(), and XMLHttpRequest.send() accept both Blobs and Files.
去获得。
js file对象 如何获得对应的data数据
<input id="uploaderCustomInput" type="file" accept="image/*" multiple="multiple" onChange={this.handleFileChange} />
handleFileChange(e) {
console.log(`handleFileChange:`);
console.log(e);
console.log(e.target);
console.log(e.target.files);
}
打印出来File的一些基本信息
FileList {0: File, length: 1}
length:1
0:File
lastModified:1501579781000
lastModifiedDate:Tue Aug 01 2017 17:29:41 GMT+0800 (CST)
name:"cow_4.jpg"
size:271136
type:"image/jpeg"
webkitRelativePath:""
__proto__:File
__proto__:FileList
但是需要知道其 更多的 关于js中的file的信息
html file object in javascript
File – Web APIs | MDN
以为file中的data数据是来自blob中:
Blob – Web APIs | MDN
Using files from web applications | MDN
Example: Showing thumbnails of user-selected images
How to instantiate a File object in JavaScript? – Stack Overflow
总结
js中的file的对象的属性有:
Properties
The File interface also inherits properties from the Blob interface:
File.lastModified Read only
Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight).
File.lastModifiedDate Read only
Returns the last modified Date of the file referenced by the File object.
File.name Read only
Returns the name of the file referenced by the File object.
File.size Read only
Returns the size of the file.
File.webkitRelativePath Read only
Returns the path the URL of the File is relative to.
File.type Read only
Returns the MIME type of the file.
然后想要获得file的data 则可以通过file集成自Blob的:
A File object is a specific kind of a Blob, and can be used in any context that a Blob can. In particular, FileReader, URL.createObjectURL(), createImageBitmap(), and XMLHttpRequest.send() accept both Blobs and Files.
去获得。
尊贵的董事大人
英文标题不为空时 视为本栏投稿
需要关键字 描述 英文标题