|
|
|
<?
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 |
|
| Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | Simple pipe delimited file export program that downloads to a local machine Categories : PHP, Filesystem, Databases, MySQL, HTTP | | | PHP4 HTTP Compression Speeds up the Web Categories : PHP, Zlib, HTML and PHP, HTTP, Network | | | 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 | | | Remote File Size Categories : PHP, Filesystem, HTTP, Sockets | | | Remote File Saving with PHP - Download and serve a remote file. The content of the file will be updated at fixed intervals. Categories : PHP, Filesystem, Cache, Sockets, HTTP | | | This script shows you the 7th latest php items from the mailing list archive on zend.com Categories : HTML, HTML and PHP, HTTP, PHP | | | Pseudo Non Parsed Header. Output to the the browser as the script runs. Categories : PHP, HTTP, HTML and PHP | | | Produces browser-safe strings while preserving HTML tags. Categories : Strings, HTTP, PHP, HTML and PHP | | | Easy upload class Categories : PHP Classes, Filesystem, HTTP, PHP | | | Browser Detection, Redirection Type, MSIE, MOZILLA, Netscape Navigator, NS, $HTTP_USER_AGENT, HTTP_USER_AGENT Categories : PHP, HTTP, Browsers, HTML and PHP | | | Force file download Categories : PHP, Filesystem, HTTP, Program Execution | | | Upload Script, Upload File Script, Input Type="File" Categories : PHP, HTML and PHP, HTTP | | | upload function using PHP's FTP abilities. Categories : PHP, Filesystem, HTML and PHP | | | Opening and formatting text files into HTML on the fly- or HTML from templates. Categories : PHP, HTML and PHP, Filesystem | |
| | | | 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?
| |
|
|
|