HTML5 FileReader interface learning notes, html5filereader

Source: Internet
Author: User

HTML5 FileReader interface learning notes, html5filereader

1. Overview of FileReader

FileReaderObjects allow Web applications to asynchronously read the content of files (or raw data buffers) stored on users' computers.FileOrBlobObject specifies the file or data to be read.

The File object can be<Input>Element returned after selecting a fileFileListObject, which can also be generated by the drag-and-drop operationDataTransferObject can also be fromHTMLCanvasElementRun onReturns the result after the mozGetAsFile () method is used..

2. FileReader Interface Method

Method Name Parameters Description
ReadAsBinaryString File Read the file as a binary code
ReadAsText File, [encoding] Read a file as text
ReadAsDataURL File Read the file as DataURL
ReadAsArrayBuffer File Read the fileArrayBuffer object
Abort (None) Interrupted read Operations

 

 

 

 

 

 

3. FileReader interface event

Event Description
Onabort Triggered when Data Reading is interrupted
Onerror Triggered when a data read error occurs.
Onloadstart Triggered when Data Reading starts.
Onprogress Reading data
Onload Triggered when Data Reading is completed successfully.
Onloadend Triggered when Data Reading is complete, no matter whether the operation fails

 

 

 

 

 

 

 

4. Use instances

<! DOCTYPE html> 

For more information, see MDN FileReader.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.