我有一个代码,它的工作原理,我用download.php保存了它,但我不知道如何下载名为simpletext.jpg的图像文件,它存在于上面的同一根目录下上述文件,我会很感激你,如果你写的实际路径,该怎么做,该代码如下....在php中下载图像文件
$file_name = "a.txt";
// extracting the extension:
$ext = substr($file_name, strpos($file_name,'.')+1);
header('Content-disposition: attachment; filename='.$file_name);
if(strtolower($ext) == "txt")
{
header('Content-type: text/plain'); // works for txt only
}
else
{
header('Content-type: application/'.$ext); // works for all extensions
except txt
}
readfile($decrypted_file_path);
如果你把一个链接页面上做,然后把它作为HREF路径的文件,并在末尾加上一个下载属性,它会为你下载文件 –
@Dhaval Chheda ....我需要更多的帮助....如果你写了一些东西...... plz – Kashif
这是什么值:$ decrypted_file_path – Andreas