Home >Web Front-end >Front-end Q&A >What are the methods of javascript file object
The methods of the javascript file object include: "CopyFile(source,destination)", DeleteFile(), MoveFile(), OpenTextFile(), iomode(), format(), etc.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
To operate files in the browser, in most cases the File object is used, obtained from the <input type='file' />
element, and then continue the operation (for example, The selected image is displayed on the page, the file is uploaded to the server using ajax, etc.). Here we introduce the API related to operating files in the browser
methods of javascript file objects
methods | Description | ##Remarks |
Copy the specified file or folder from one location to another | obj: file or folder | source: source filedestination: required, copy the file Or the destination location of the folder overwrite: optional. Overwrite is true, otherwise it is false, and the default is true | ##obj.DeleteFile(file,[force])
obj: file or folder | file: file to be deleted | force: optional, boolean value, if the read-only attribute is set to be deleted file or folder, it is true, otherwise it is false
| obj.MoveFile(Source, Destination)
Source: file or folder | Destination: the destination location to move the file or folder | |
Read, write or append the file through this object | FileName: should be the name of the File object IOMode: Optional, the specified input/output mode, which can be one of three constants: | IOMode One to specify the format of the open file, If omitted, the file will be opened in ASCII format ##iomode() |
Value | Description | ForReading | 0
ForWriting | 1 | |
ForAppend | 8 | |
format() |
##constant
Description | TristateUseDefault-2 | |
TristateTrue | -1 | |
TristateFalse | 0 | |
[Recommended learning: | javascript advanced tutorial | ]
The above is the detailed content of What are the methods of javascript file object. For more information, please follow other related articles on the PHP Chinese website!