|
|
|
|
|
<?
error_reporting(0);
$filename="adi_and_berber.gif";
$path="";
If(!IsSet($command)) $command == 0;
If($command == 0) {
?>
<HTML>
<BODY>
<BR><BR><BR><BR>
<CENTER>
<A HREF="PictureDownload.php3?command=1"><IMG SRC="<?echo"$filename";?>" BORDER="0"></A>
</CENTER>
</BODY>
</HTML>
<?
}
If($command == 1) {
header("Content-Disposition: attachment; filename=$filename");
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize("$path/$filename"));
header("Pragma: no-cache");
header("Expires: 0");
$fp=fopen("$path/$filename","r");
print fread($fp, filesize("$path/$filename"));
fclose($fp);
exit();
}
?>
View examples here :
http://new.weberdev.com/GeneralDev/examples/1562/DownloadFile.php
http://new.weberdev.com/GeneralDev/examples/1562/PictureDownload.php3 |
|
| Handle multiple file upload Categories : Complete Programs, Filesystem, PHP, HTML and PHP | | | Directory viewer, customize how you display the file structure, easy to
understand. Found out about PHP 3 days ago, and this is my first prog. Categories : HTML and PHP, Complete Programs, Directories, Filesystem, PHP | | | This script shows you the 7th latest php items from the mailing list archive on zend.com Categories : HTML, HTML and PHP, HTTP, PHP | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | Browser Detection, Redirection Type, MSIE, MOZILLA, Netscape Navigator, NS, $HTTP_USER_AGENT, HTTP_USER_AGENT Categories : PHP, HTTP, Browsers, HTML and PHP | | | Easy upload class Categories : PHP Classes, Filesystem, HTTP, PHP | | | Simple pipe delimited file export program that downloads to a local machine Categories : PHP, Filesystem, Databases, MySQL, HTTP | | | Class that allows the PHP developer to create and manage UNIX like password files suitable for use as Apache authentication password files.
Categories : HTTP, PHP, PHP Classes, Filesystem | | | Force file download Categories : PHP, Filesystem, HTTP, Program Execution | | | PHP4 HTTP Compression Speeds up the Web Categories : PHP, Zlib, HTML and PHP, HTTP, Network | | | Using php3 to upload files, uploading files, file uploads. Categories : PHP, Filesystem, HTTP | | | A simple php file uploader Categories : PHP, Filesystem, HTML and PHP | | | Open directory and File download Categories : PHP, Filesystem, Directories, HTML and PHP | | | PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use! Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP | | | Produces browser-safe strings while preserving HTML tags. Categories : Strings, HTTP, PHP, HTML and PHP | |
| |
| | | | | Kelvin Lee wrote :1356
I tried to put the script at bottom in my php script but file could not be ask for download but opened it in the browser. Why?
| |
|
|