欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

用PHP实现上载任何类型的文件

程序员文章站 2024-02-16 09:57:04
...
我这个程序可以让你上传任何类型的文件并可以直接显示或下载下来(upload_and_show.php3):

  
  if($submit)

  {

   header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

   header("Cache-Control: no-cache, must-revalidate");

   header("content-type:application/octet-stream");

   header("content-disposition:inline;filename=$form_data");

   header("content-description:php3 generated data");

  

   $fd = fopen($form_data,"r");

   while($string = fread($fd,200)){

   echo $string;

   }

   fclose($fd);

  }

else { ?>