This is a discussion on "display folder contents + specific text for a particular file type" within the Classic ASP section. This forum, and the thread "display folder contents + specific text for a particular file type are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
display folder contents + specific text for a particular file type
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
display folder contents + specific text for a particular file type
Hi am creating a site that when a menu item is clicked it displays the contents of a specific folder - PDFs, PPT documents etc....
It lists the file type icon, name of the file, size and date last modified. What I want to do is add "right click - save link as" after the date, but only to PowerPoint documents. Any help with this would be greatly appreciated. |
|
|
|
#2
|
|||
|
|||
|
Re: display folder contents + specific text for a particular file type
Hi magnum.
The easiest thing to do is look at the last 4 characters of each file's name (your best bet is to turn the filename into lowercase first). If the file ends in ".ppt", your write the specified text. The example I use below assumes each file's details are stored in a database. I can supply you a more relevant example if you'd like to supply the code you're using.
The LCase function returns a string in lower case, so it'll turn "PowerPointFile.PPT" into "powerpointfile.ppt". This value is then loaded into the strFilename variable. The Right function returns the right-hand portion of a string (in this case strFilename). The number 4 means that the function must return the last four characters of the filename (we're looking for ".ppt"). We then use a simple If...Then...Else statement, using Response.Write to write the appropriate text toto the page. The reason we need to want to include the dot (.) in the extension is so that we know those last four letters are the extension for the file, and not part of the main body of the filename. Hope that's of some use. If not, or if the example isn't relevant, pass me the page you're working on and I'll take a look. Kind regards, -Mark View my web development blog Last edited by elopus; Aug 17th, 2006 at 13:05. Reason: Had to remove bold formatting in CODE block, as it removed my line-breaks |
![]() |
| Tags |
| display, folder, contents, specific, text, particular, file, type |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi file uploader and folder create | 737mechanic | PHP Forum | 1 | Sep 29th, 2007 11:03 |
| Using type 'Text' everywhere, wrong? | @lun | Databases | 1 | Aug 8th, 2007 18:46 |
| Can I put style sheet in the root folder that targets a specific html page | badger | Web Page Design | 3 | Jul 14th, 2007 17:35 |
| script to list folder contents as links | taras | JavaScript Forum | 0 | May 26th, 2007 09:59 |
| Folder and file management | pengyou | Starting Out | 4 | May 23rd, 2007 08:23 |