Project development process, involving the image upload and file upload. In the "Picture upload" and "File Upload" feature, I used the form form in the project, a simple example is as follows:
One, picture or file upload
The HTML code is as follows:
The rendering effect on the page is as follows:
Select the file, click Submit, and execute the following results:
The first diagram of the results shown above shows that the action in form forms has been executed, and that the second diagram of the results above shows that the selected file and related information have been uploaded. Upload completed, the rest of the matter to the background processing.
second, after the upload is completed, get the return information.
After the image or file upload, we need to return information in the background to determine whether the upload is successful, get the method of return information, through the following simple example:
JS Code:
The results of the implementation are as follows:
As you can see from the execution result graph, the "Internal server error" information is fetched and printed.
In addition, usually in the project, the IFRAME is hidden, and here it appears to be more intuitive.