Home  >  Article  >  Backend Development  >  How to use MIME protocol with forms to download files on iPhone?

How to use MIME protocol with forms to download files on iPhone?

WBOY
WBOYOriginal
2016-09-03 00:14:111297browse

I made a tool for downloading music websites online. It was written in PHP and included Content-type & Content-Disposition in the MIME protocol. It was tested on computers and Android devices and can be downloaded normally. The code is as follows (used for testing. The code layout is a bit messy. Please bear with me. ):
How to use MIME protocol with forms to download files on iPhone?

How to use MIME protocol with forms to download files on iPhone?

MP3 format files are directly parsed and played by the browser when opened in the browser. The purpose of this online tool is to obtain the link (MP3 format) from a website and then force the browser to download the MP3 file through the MIME protocol instead of playing it online. Assuming that it is good The website address is: http://www.w00yun.top/echo.php
How to use MIME protocol with forms to download files on iPhone?

By entering the link in this way, you can directly download the file in MP3 format, and it has been successfully tested on computers and Android browsers. However, when you get it on an iPhone and use the Safari browser that comes with the iPhone, the download is as simple as this:
How to use MIME protocol with forms to download files on iPhone?

I am just a PHP enthusiast, I have never learned programming professionally, and I have never done any programming-related work. After Baidu learned that the browser that comes with the iPhone cannot download things at will, I then used the QQ browser on the iPhone to download it. It can be downloaded, but the download file size is obviously wrong:
How to use MIME protocol with forms to download files on iPhone?

So I started to test what went wrong. Through Google, I saw on oschina that the style of the form submit button is invalid on Safari browser
How to use MIME protocol with forms to download files on iPhone?

How to use MIME protocol with forms to download files on iPhone?

I thought it was a problem with form submission, but after checking the answer, I found that it was not the answer I wanted. And through testing, if you comment out the MIME protocol, the download link obtained directly through the form submission output can be obtained normally
How to use MIME protocol with forms to download files on iPhone?

From this, I judged that it was not the cause of the form, and then I directly assigned the link to the variable separately. I found that it can be downloaded normally through the MIME protocol download, and the song size is normal and can be played:
How to use MIME protocol with forms to download files on iPhone?

In this way, it is possible to obtain the download link or download directly through the MIME protocol in the QQ browser of the iPhone, but it is not possible to download the normal file through extracting the link through the form and then downloading through MIME. I don’t know what the problem is. I hope it can be done. Please help with the answer, thank you!

Reply content:

I made a tool for downloading music websites online. It was written in PHP and included Content-type & Content-Disposition in the MIME protocol. It was tested on computers and Android devices and can be downloaded normally. The code is as follows (used for testing. The code layout is a bit messy. Please bear with me. ):
How to use MIME protocol with forms to download files on iPhone?

How to use MIME protocol with forms to download files on iPhone?

MP3 format files are directly parsed and played by the browser when opened in the browser. The purpose of this online tool is to obtain the link (MP3 format) from a website and then force the browser to download the MP3 file through the MIME protocol instead of playing it online. Assuming that it is good The website address is: http://www.w00yun.top/echo.php
How to use MIME protocol with forms to download files on iPhone?

By entering the link in this way, you can directly download the file in MP3 format, and it has been successfully tested on computers and Android browsers. However, when you get it on an iPhone and use the Safari browser that comes with the iPhone, the download is as simple as this:
How to use MIME protocol with forms to download files on iPhone?

I am just a PHP enthusiast, I have never learned programming professionally, and I have never done any programming-related work. After Baidu learned that the browser that comes with the iPhone cannot download things at will, I then used the QQ browser on the iPhone to download it. It can be downloaded, but the download file size is obviously wrong:
How to use MIME protocol with forms to download files on iPhone?

So I started to test what went wrong. Through Google, I saw on oschina that the style of the form submit button is invalid on Safari browser
How to use MIME protocol with forms to download files on iPhone?

How to use MIME protocol with forms to download files on iPhone?

I thought it was a problem with form submission, but after checking the answer, I found that it was not the answer I wanted. And through testing, if you comment out the MIME protocol, the download link obtained directly through the form submission output can be obtained normally
How to use MIME protocol with forms to download files on iPhone?

From this, I judged that it was not the cause of the form, and then I directly assigned the link to the variable separately. I found that it can be downloaded normally through the MIME protocol download, and the song size is normal and can be played:
How to use MIME protocol with forms to download files on iPhone?

In this way, it is possible to obtain the download link or download directly through the MIME protocol in the QQ browser of the iPhone, but it is not possible to download the normal file through extracting the link through the form and then downloading through MIME. I don’t know what the problem is. I hope it can be done. Please help with the answer, thank you!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn