Example: Upload any type of file with PHP and can display or download it directly

Source: Internet
Author: User
Download | Show me this program allows you to upload any type of file and can be displayed or downloaded directly (UPLOAD_AND_SHOW.PHP3):
<?php
if ($submit)
{
Header ("Expires:mon, June June 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 {?>
<form method= "POST" action= "<?php echo $php _self;?>" enctype= "Multipart/form-data" >
File description:<br>
<input type= "text" name= "form_description" size= ">"
<input type= "hidden" name= "max_file_size" value= "1000000" >
<br>file to Upload/store in database:<br>
<input type= "File" Name= "Form_data" size= ">"
<p><input type= "Submit" name= "submit" value= "Submit" >
</form>
<?php}?>




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.