First of all, let's take a look at the construction method of File:
- File(String pathname): Get the File object according to a path
- File(String parent,String child): Get a File object based on a directory and a subfile/directory
- File(File parent,String child): Get a File object based on a parent File object and a child file/directory
-
java.io.File.mkdir(): Only a first-level directory can be created, and the parent directory must exist, otherwise a directory cannot be created successfully. java.io.File.mkdirs(): Multi-level directories can be created, and the parent directory does not necessarily exist
No form tags are required to implement asynchronous file uploads. The front desk purchase is:
The corresponding ajax is:
processData:false//Do not process data.
contentType:false//Do not set the content type
In addition, due to the use of ajax, it is not necessary to add its url attribute in FormData
The code behind is implemented as:
page effect: