Wrote a simple html/php uploaded Web page, both on Android and the computer is normal, but the ipad has a problem, that is, the image upload name will automatically become image.jpg

Source: Internet
Author: User
This is the problem with the ipad safari or Chrome.

html
  
   
phpupload_file.php
  0) {//echo "Return Code:". $_files["File" ["Error"]. "
"; } else {echo "Upload:". $_files["File" ["Name"]. "
"; echo "Type:". $_files["File" ["type"]. "
"; echo "Size:". ($_files["File" ["Size"]/1024). The Kb
"; echo "Temp file:". $_files["File" ["Tmp_name"]. "
"; if (File_exists ($DIR. $_files["File" ["Name"])) {echo $_files["file" ["Name"]. "already exists."; Header (' location:http://59.78.7.9/index.html '); } else {move_uploaded_file ($_files["file"] ["Tmp_name"], $DIR. $_files["File" ["name"]); echo "Stored in:". $DIR. $_files["File" ["Name"]; Header (' location:http://59.78.7.9/index.html '); }}} else {echo "Invalid file, you can ' t upload files of". $postfix;}? >

Reply content:

This is the problem with the ipad safari or Chrome.

html
  
   
phpupload_file.php
  0) {//echo "Return Code:". $_files["File" ["Error"]. "
"; } else {echo "Upload:". $_files["File" ["Name"]. "
"; echo "Type:". $_files["File" ["type"]. "
"; echo "Size:". ($_files["File" ["Size"]/1024). The Kb
"; echo "Temp file:". $_files["File" ["Tmp_name"]. "
"; if (File_exists ($DIR. $_files["File" ["Name"])) {echo $_files["file" ["Name"]. "already exists."; Header (' location:http://59.78.7.9/index.html '); } else {move_uploaded_file ($_files["file"] ["Tmp_name"], $DIR. $_files["File" ["name"]); echo "Stored in:". $DIR. $_files["File" ["Name"]; Header (' location:http://59.78.7.9/index.html '); }}} else {echo "Invalid file, you can ' t upload files of". $postfix;}? >

    1. That's right. The picture on the ipad doesn't have the concept of "file name" at all.
    2. When storing files, do not discard the same file name ... File storage is not a preemptive type ...
    3. A file with the same name plus a suffix, or simply the entire file after the calculation SHA-1 with a checksum file name.
    4. Determine the file type cannot depend on the file extension, but use the exif_imagetype() function to check the actual file header.

May I ask how this problem is solved? I am the Apple phone upload image name is changed to Image.jpg by default. We're using HTML5. Android and browser uploads are normal.

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