Php ajax implements a file upload progress bar,
This example is about the implementation of the progress bar during PHP file upload, mainly using ajax technology, and also using html5. If you need it, you can study it.
This instance has two files:
Upload_form.html:
<!DOCTYPE html>
File_upload_parser.php:
<?php$fileName = $_FILES["file1"]["name"]; // The file name$fileTmpLoc = $_FILES["file1"]["tmp_name"]; // File in the PHP tmp folder$fileType = $_FILES["file1"]["type"]; // The type of file it is$fileSize = $_FILES["file1"]["size"]; // File size in bytes$fileErrorMsg = $_FILES["file1"]["error"]; // 0 for false... and 1 for trueif (!$fileTmpLoc) { // if file not chosen echo "ERROR: Please browse for a file before clicking the upload button."; exit();}if(move_uploaded_file($fileTmpLoc, "test_uploads/$fileName")){ echo "$fileName upload is complete";} else { echo "move_uploaded_file function failed";}?>
The above is all the content of this article, hoping to help you learn.
Articles you may be interested in:
- JQuery Ajax File Upload (php)
- Ajax + php build progress bar readyState status
- Ajax + php build progress bar code [readyState status description]
- File, FileReader, and Ajax File Upload instance analysis (php)
- Code example for asynchronous file upload using Ajax in php
- Php + ajax Implementation of big data queuing with progress bar export ideas and source code
- Example of php + ajax function for uploading image files
- ThinkPHP combined with AjaxFileUploader to implement the method of uploading non-refreshing files
- Ajax_upload upload progress bar code implemented by PHP + apc + ajax