Groups
Groups
Sign in
Groups
Groups
日本Androidの会
Conversations
About
Send feedback
Help
PHPのWEBページからmp3のダウンロード
708 views
Skip to first unread message
メソコ
unread,
Sep 29, 2011, 5:51:20 AM
9/29/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 日本Androidの会
はじめまして。
Android初心者で、どうして良いかわからず、
投稿させて頂きました。
PHPのWEBページでmp3ファイルをダウンロードさせたいのですが、
PCではうまくいくのに、androidからだとうまくダウンロードできません。
ダウンロード完了となるのですが、
ファイルが0バイトになってしまいます。
PHPのコードは下記です。
$filename = "test.mp3";
$size = filesize( $filename );
header("Content-Type: audio/mp3" );
header("Content-Length: " . $size);
header('Content-Disposition: attachment; filename="test.mp3"');
header("Content-Transfer-Encoding: binary");
readfile($filename);
httpd.confにmp3は追加してあります。
AddType audio/mp3 .mp3
gifファイルでも試してみましたが
同じような現象が起きました。
$filename = "logo_240.gif";
$size = filesize( $filename );
header('Content-Type: image/gif');
header('Content-Disposition: attachment; filename="test.gif"');
header('Content-Length: ' . $size);
readfile($filename);
申し訳ありませんが、
ご教授頂ければと思います。
tyone
unread,
Oct 1, 2011, 12:33:27 AM
10/1/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-g...@googlegroups.com
米山と申します。
私のほうでも試してみましたが、Xperia arc の標準ブラウザでは正しく動きました。
コードも見た感じでは間違いないと思います。
試した環境などもう少し詳しく書いていただけるとわかることがあるかも知れません。
よろしくお願い致します。
Reply all
Reply to author
Forward
0 new messages