Php ajax implements a file upload progress bar,

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.