在我的职务门户项目中,我已将求职者数据存储在MySQL数据库中。我已将他们上传的简历存储在“上传”文件夹中。我可以通过分页为雇主检索求职者的数据。我想创建每个求职者的下载简历链接,并在分页结果中提供他的数据。如何为上传文件夹中的简历文件添加下载简历链接,以及分页中的每个搜索结果?
发布于 2012-08-19 07:06:39
在这里找到解决方案:http://www.ssdtutorials.com/tutorials/title/download-file-with-php.html
因为我想下载的文件与每个求职者的数据是动态关联的。我使用while循环从数据库中检索文件名。
$result = mysql_query($query);
while($row = mysql_fetch_row($result))
{
$filename = $row[0];
echo "<p><a href='download.php?file=$filename'> Download Resume </a></p>";
}
发布于 2012-08-19 05:57:33
如果我明白这个问题,这是很容易的。因为您在上传文件夹中有简历文件。只需从数据库中选择文件名并将其存储在变量上,比方说$filename
,如下
$filename = $row['cv_filename']; // supposing $row contains the field of database
然后,使用锚中的文件夹名前缀--指向该文件的链接。
$prefix = "uploads/resume";
echo "<a href='$prefix/$filename'>Download CV </a>";
发布于 2012-08-19 05:51:27
header("Content-type: $type");
header("Content-length: $size");
header("Content-Disposition: attachment; filename=$name");
header("Content-Description: PHP Generated Data");
echo $data;
阅读完整示例@ mysql.html?page=3
https://stackoverflow.com/questions/12024494
复制相似问题