Hello -

I'm trying somehow to setup something that will allow me to create a block listing that shows whatever the last files uploaded were. Is there some way to do that, or perhaps some other module that I could use to perform that function?

Thanks...

Comments

zephyr325’s picture

Rather than do a view, I ended up writing a custom block that will show the last 10 files uploaded to the WebFM library and the date that they were uploaded. The fille name links directly to the file itself so folks can download it from there.

<?php

$res = db_query("select substring_index(fpath,'/',-1) as FileName, fpath as FullPath, fcreatedate as Filedate from webfm_file order by fcreatedate desc limit 10");

print '<table><tr><td><b>Date</b></td><td><b>File</b></td></tr>';

while ($f = db_fetch_array($res)) {

  print '<tr><td valign="top">'.date("m\\\d",$f['Filedate']).'</td><td>';
  $GoodURL = file_create_url($f['FullPath']);
  print l($f['FileName'],$GoodURL);
  print '</td></tr>';

}

print '</table>';

?>

By the way, the "file_create_url" is a very, very cool function I found after struggling with how to clean up illegal html characters that could be in a file name. :)

zephyr325’s picture

Component: Code » Miscellaneous
Assigned: Unassigned » zephyr325
Status: Active » Needs review
nhck’s picture

Status: Needs review » Closed (won't fix)

As per #803722: Cease support of Drupal 5? support for D4 and D5 has been closed. Sorry, please upgrade to Drupal 6. If you think this issue still applies with Version 6.x please reopen this issue with correct version tag.

Thank you! :-)