Class File
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The File interface provides information about files and allows JavaScript in a web page to access their content.
[Value("File")]
public class File : Blob
- Inheritance
-
File
- Inherited Members
Remarks
File objects are generally retrieved from a FileList object returned as a result of a user selecting files using the {{HTMLElement("input")}} element, or from a drag and drop operation's DataTransfer object.
A File object is a specific kind of Blob, and can be used in any context that a Blob can. In particular, the following APIs accept both Blobs and File objects:
See Using files from web applications for more information and examples.
Constructors
File()
public File()
File(List<Union44>, string, FilePropertyBag)
The File() constructor creates a new File
object instance.
public File(List<Union44> fileBits, string fileName, FilePropertyBag options = null)
Parameters
fileBitsList<Union44>fileNamestringoptionsFilePropertyBag
Remarks
Properties
LastModified
The lastModified read-only property of the File interface provides the
last modified date of the file as the number of milliseconds since the Unix
epoch (January 1, 1970 at midnight). Files without a known last modified date return the
current date.
[Value("lastModified")]
public long LastModified { get; }
Property Value
- long
A number that represents the number of milliseconds since the Unix epoch.
Remarks
Name
The name read-only property of the File interface returns the name of the file represented by a File object. For security
reasons, the path is excluded from this property.
[Value("name")]
public string Name { get; }
Property Value
- string
A string, containing the name of the file without path, such as "My Resume.rtf".
Remarks
WebkitRelativePath
The webkitRelativePath read-only property of the File interface
contains a string which specifies the file's path relative to the
directory selected by the user in an input element with itswebkitdirectory attribute set.
[Value("webkitRelativePath")]
public string WebkitRelativePath { get; }
Property Value
- string
A string containing the path of the file relative to the ancestor
directory the user selected.