File Uploads - Filter file types

4 posts by 3 authors in: Forums > CMS Builder
Last Post: December 27, 2011   (RSS)

By gversion - December 24, 2011

Hello,

On my website users can upload files to their listings. Files can be images (e.g. GIF/JPG) and documents (e.g. PDF/DOC).

The uploaded images are being displayed neatly in a photo gallery lightbox.

Is there a way I can display a bullet point list of only the PDF or DOC(X) files that have been uploaded?

Thank you,
Greg

Re: [gversion] File Uploads - Filter file types

By northernpenguin - December 26, 2011

Hi Greg

Well, it really depends on how you wrote your code, but if you use the basic code from code generator you will notice the "if statement".

The if statement first displays thumbnails based on certain conditions, else the full image, and if a document, a link for download.

By using this basic structure, you should be able to build your own filter system.

You can also check The CMSB Cookbook for additional information (http://www.thecmsbcookbook.com).

Happy Holiday!
--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [gversion] File Uploads - Filter file types

By robin - December 27, 2011

Hey Greg,

The code generator creates a true/false value ($upload['isImage']) you can use to test images:

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>


Hope that helps,
Robin
Robin
Programmer
interactivetools.com