jackie777
asked on
PHP upload and list updater program
Hi,
Im a looking for some general (or specific) advice on how I can accomplish the following using php and mysql.
I want to give the user the ability to upload a pdf document to a file on the server. (I have this part figured out already using a php based upload form)
I want to have a web page that lists the pdfs that have been uploaded that directory in order by date 2007_01_12, 2006_06_04...ect
So I guess what I am wondering is how would I make it so the user simply uploads a document to the server. But, when the document gets uploaded, the php updates the web page that lists all the the documents in the upload directory listing a link to that newly uploaded document.
Is there a any to accomplish this without a database? Does anyone know where I could find some example code that does this?
Im a looking for some general (or specific) advice on how I can accomplish the following using php and mysql.
I want to give the user the ability to upload a pdf document to a file on the server. (I have this part figured out already using a php based upload form)
I want to have a web page that lists the pdfs that have been uploaded that directory in order by date 2007_01_12, 2006_06_04...ect
So I guess what I am wondering is how would I make it so the user simply uploads a document to the server. But, when the document gets uploaded, the php updates the web page that lists all the the documents in the upload directory listing a link to that newly uploaded document.
Is there a any to accomplish this without a database? Does anyone know where I could find some example code that does this?
ASKER
That worked perfectly, thanks.
Any idea what could do to limit the list that is displayed to 50? So that as new files are added, the old ones no longer become available.
Any idea what could do to limit the list that is displayed to 50? So that as new files are added, the old ones no longer become available.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$d = dir("directory_path");
while (false !== ($entry = $d->read())) {
if($entry != "." && $entry !="..") {
$time = filectime($d->path.DIRECTO
$files[$time]["name"][] = $entry ;
$files[$time]["path"][] = $d->path.DIRECTORY_SEPARAT
}
}
$d->close();
krsort($files);
foreach($files as $value) {
if(count($value["name"]) > 1) {
for($i=0;$i<count($value["
print "<a href='".$value["path"][$i]
}
}else{
print "<a href='".$value["path"][0].
}
}
?>