Online! An upload file on the question, we help the little girl ah ah ah ~

Source: Internet
Author: User
Online Help! A download file problem, we help the little girl ah ah ah ~ ~
$file _name = ' Http://5.66825.com/download/ring/000/102/0b6983e56159d5e830936096e27b2479.mp3 ';
$file _dir = ";
$title = ' downloaded ringtones ';
$title =str_replace (' \ ', ' ', $title);

$rename = ' rename '. ' _ '. $title. ' MP3 ';
if (!file_exists ($file _dir. $file _name)) {//check if file exists
echo " File does not exist ";
Exit
} else {
Here is the key to php file download
Header ("Content-type:application/octet-stream");
Header ("Accept-ranges:bytes");
Header ("Content-type:application/force-download");//Force browser download
Header ("content-disposition:attachment; Filename=\ "". $rename. " \ "");//rename file
Header ("Accept-length:". FileSize ($file _dir. $file _name));//File size
Read File contents
@readfile ($file _dir. $file _name); [Email protected]
}
?>

My problem now is that I want to download the remote MP3 file from the file above, but always fail, always prompt for the file does not exist.
But if I make a decision, it can be downloaded, but the downloaded file is bad (not the actual path file)


------Solution--------------------
Your code works, and if you judge that segment to be removed. Wait for it to finish.
------Solution--------------------
FileSize does not support detecting remote files, a function file_get_contents () can
  • 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.