PHP File upload page Simple implementation

Source: Internet
Author: User
Tags php file upload
PHP File download page simple implementation
function Get_extension ($file) {return substr (STRRCHR ($file, '. '), 1);   } function Get_name ($path) {return substr (STRRCHR ($path, '/'), 1);  } function GetImage ($url, $fileName = "") {$fbufsize = 8096; $ext = Get_extension ($url); $fileName = Get_name ($url); $type = Array (' gif ' = ' image/gif ', ' jpeg ' = ' image/jpeg ', ' jpg ' = ' image/jpeg ', ' jpe ' = ' image/jpeg ', ' png ' = ' I ' Mage/png ',); $imgType = Isset ($type [$ext])? $type [$ext]:d ie ("type does not match"); header (' Content-description:file Transfer '); Header (' expires:0 '); header (' Cache-control:must-revalidate, post-check=0, pre-check=0 '); header (' Pragma:public '); Header ("Content-type:". $imgType); Header ("Content-transfer-encoding:binary"); Header (' Content-disposition: Attachment Filename= "'. $fileName. ' '); Header ("Content-length:".) GetImageSize ($url). "   \ n "); $fp = fopen ($url, "R"), while (!feof ($fp)) {print (Fread ($fp, $fbufsize)), flush (); Ob_flush ();}    Fclose ($fp); exit;} GetImage ("Http://www.lpfrx.com/wp-content/themes/ProSense/images/rss-feed-icOn.jpg "); 

With jquery before and after the table to deal with or very strong, examples of


$ ("img"). Click (function () {
var path = $ (this). attr ("src");
location.href= "Test.php?path=" +path;
})

It's been tested.

No matter what format you download, you can change it, so back up to check


  • Related Article

    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.