I am developing a site which allows users to upload files (specifically Word documents) to the webserver, documents in an MySQL database who uploaded the file, the filename, the date, etc. Then, there is a page for admins to log in and download these files for review. I would like to make it so that when one person downloads a file, it flags it in the database as being downloaded and by whom. I have a script written which lists all of the files currently uploaded, and now I'm trying to make a system to perform the second part. Does anyone have any suggestions? I thought about having like a radio button next to each of the files, and then you pick one and click "Submit" which would take you to a php script which would basically do a redirect to that file and force a download, but I can't seem to figure out how to determine which file has been selected. This is part of the script that displays the files:
So basically it's a while loop which lists all of the rows of uploaded files in the database. Does anyone have any suggestions for how I can take the next step (downloading)? I need to flag the file as downloaded so someone doesn't download a file that's already been viewed. Thanks!
while ($row = mysql_fetch_array($result)) {
$user_id = $row['user_id'];
$username = $row['username'];
$filename = $row['filename'];
$submit_date = $row['submit_date'];
$downloaded = $row['downloaded'];
$download_date = $row['download_date'];
$download_id = $row['download_id'];
if ($downloaded == "N") {
$download_date = "NA";
}
if ($counter %2 == 0) {
echo "<tr bgcolor=#FFFFFF onMouseOver=this.className='highlight'; onMouseOut=this.className='normal';>";
}else{
echo "<tr bgcolor=#DDDDDD onMouseOver=this.className='highlight'; onMouseOut=this.className='normal2';>";
}
td_print($username);
td_print($filename);
td_print($submit_date);
td_print($downloaded);
td_print($download_date);
echo "<td><input type=radio name=download value=Y></td>";
tr_print();
$counter++;
}
So basically it's a while loop which lists all of the rows of uploaded files in the database. Does anyone have any suggestions for how I can take the next step (downloading)? I need to flag the file as downloaded so someone doesn't download a file that's already been viewed. Thanks!