質問編集履歴
2
コードブロック
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
現在、PHPを利用してファイルをダウンロードさせたいと考えています。
|
2
2
|
|
3
|
+
```PHP
|
3
4
|
<?php
|
4
5
|
if (isset($_GET[‘file’]))
|
5
6
|
{
|
@@ -11,9 +12,12 @@
|
|
11
12
|
header('Content-Disposition: attachment; filename="'.$file.'"');
|
12
13
|
readfile($file);
|
13
14
|
?>
|
15
|
+
```
|
14
16
|
|
15
17
|
上記の記述で、
|
18
|
+
```URL
|
16
19
|
http://~~/download.php?file=audio/sample.mp3
|
20
|
+
```
|
17
21
|
と入力した時にaudio/内のsample.mp3がうまくダウンロードできません。
|
18
22
|
|
19
23
|
*以下のデータが記述されたファイルがダウンロードされます。
|
1
不具合の詳細
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,6 +16,12 @@
|
|
16
16
|
http://~~/download.php?file=audio/sample.mp3
|
17
17
|
と入力した時にaudio/内のsample.mp3がうまくダウンロードできません。
|
18
18
|
|
19
|
+
*以下のデータが記述されたファイルがダウンロードされます。
|
20
|
+
<br />
|
21
|
+
<b>Warning</b>: readfile(): Filename cannot be empty in <b>/home/~~/public_html/download.php</b> on line <b>11</b><br />
|
22
|
+
|
23
|
+
ファイルの読み込みが出来ていないようです。
|
24
|
+
|
19
25
|
どの部分を修正すれば、うまくダウンロードできるようになりますでしょうか?
|
20
26
|
勉強中の初心者で申し訳ありませんが、
|
21
27
|
ご教授のほどよろしくお願い致します。
|