PHP Ajax Upload File instance [ajaxfileupload.js]_php Tutorial

Source: Internet
Author: User
Talk about the use of jquery Ajax and PHP implementation of the image upload, the following I introduce the use of PHP Ajax to achieve a variety of files without refreshing upload, directly put an example of hope for the students to help.

Can be added in bulk upload, simple and convenient

The code is as follows Copy Code






up_deal.php

code as follows copy code

"!--? php
if ((($_files["File1") ["type"] = = "Image/gif")
| | ($_files["File1" ["type"] = = "Image/jpeg")
| | ($_files["File1" ["type"] = = "Image/bmp")
| | ($_files["File1" ["type"] = = "Image/pjpeg"))
&& ($_files["File1" ["Size"] < 100000)) {//100kb
$extend = Explode (".", $_files["File1" ["name"]);
$key = count ($extend)-1;
$ext = ".". $extend [$key];
$newfile = Time (). $ext;

If (!file_exists (' upload ')) {mkdir (' upload ');}
Move_uploaded_file ($_files["File1" ["Tmp_name"], "upload/". $newfile);
@unlink ($_files[' file1 ');
Echo $newfile;
}else {
echo ' error ';
}
?

http://www.bkjia.com/PHPjc/632906.html www.bkjia.com true http://www.bkjia.com/PHPjc/632906.html techarticle talk about the use of jquery Ajax and PHP implementation of the image upload, the following I introduce the use of PHP Ajax to achieve a variety of files without refreshing upload, directly put an example of hope for the students to help. Can be added in bulk ...

  • 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.