[PHP-users 32994] PHPにてファイルをダウンロードしたいのですが・・
tamayanz @ yahoo.co.jp
tamayanz @ yahoo.co.jp
2007年 12月 8日 (土) 11:17:55 JST
$B>>K\$H8@$$$^$9!#(B
$B%5!<%P!<$K$"$k%U%!%$%k$r%f!<%6!<$,;XDj$7$?J*$r%@%&%s2DG=(B
$B$K(B
$B$7$?$$$N$G$9!#(B
$B#P#G!J#P#H#P$N$_!K$K$h$j%@%&%s%m!<%I$5$;$?$$$N$G$9$,!"(B
$B%0%C%0%F$_$k$H!"2<5-$N#P#G$K$F#O#K$H=q$$$F$^$9!#(B
$B$7$+$7<B:]$O%@%&%s=PMh$^$;$s!#(B
$B#P#CB&$+!"%5!<%P!<B&$K$F @ _Dj$9$k;v9`$,$"$k$N$G$7$g$&$+!)(B
$B!#(B
$B$4;XF3$NDx59$7$/8f4j$$CW$7$^$9!#(B
$B-!#C#S#V%U%!%$%k$N>l9g(B
outcsv.php$B$NFbMF(B
<?php
$orgfname = "sijou.csv"; $newfname = "kabu.csv";
$fsize = filesize($orgfname);
header("Accept-Ranges: 2000 ");
header("Content-Disposition: attachment; filename=
\"{$newfname}\" ");
header("Content-Transfer-Encoding: binary");
header("Content-Length: $fsize " );
header("Content-Type: text/octet-stream");
readfile($newfname);
?>
$B7k2L$O(B a)$B%@%$%"%m%0$K(B$newfname$B$,$G$J$$$G!"!V(Boutcsv.php
$B!W$,=P$k!#(B
b)\downloads\$B$K!V(Bsijou.csv.ob!$B!W$,DI2C$5$l$k(B
$B$,!"3+$1$^$;$s$7!"(B
$B:o=|$b$G$-$^$;$s!#(B
$B-"#J#P#G%U%!%$%k$N>l9g(B
downsx.php$B$NFbMF(B
<?php
$orgfname = "./mid/51.jpg"; //$B%5!<%P!<B&$K$"$k%U%!%$%k(B
$newfname = "c:/abcd.jpg"; //
$fsize = filesize($orgfname);
header("Accept-Ranges: 2000000 ");
header("Content-Disposition: attachment; filename=
\"{$newfname}\" ");
header("Content-Transfer-Encoding: binary");
header("Content-Length: $fsize " );
header("Content-Type: image/jpeg");
$handle = fopen($orgfname, "rb");$fp2 = fopen($newfname,
"wb");
$contents = fread($handle, filesize($orgfname));
copy($contents, $newfname);
fclose($handle); // readfile($newfname);
?>
$B7k2L$O(B a)$B%@%$%"%m%0$K(B$newfname$B$,$G$J$$$G!"!V(Bdownsx.php
$B!W$,=P$k!#(B
b)\downloads\$B$K!V(Babcd.jpg.ob!$B!W$,DI2C$5$l$k$,(B
$B!"3+$1$^$;$s$7!"(B
$B:o=|$b$G$-$^$;$s!#(B
$B-#(B $B$^$?!"O"B3$7$F%F%9%H$9$k$H!"%U%!%$%kL>$rJQ99$7$F$b!"(B
$B!V$9$G$K#P#C$K(B
$BB8:_$7$^$9!W$H%3%a%s%H$,$G$F!"%@%&%sIT2D$K$J$j(B
$B$^$9!#(B
$B0J>e$N$h$&$J>u67$G$9!#59$7$/8f4j$$CW$7$^$9!#(B
PHP-users メーリングリストの案内