Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
IF File type

 

 


rjbathgate
User

Jul 21, 2008, 5:59 PM

Post #1 of 2 (213 views)
Shortcut
IF File type Can't Post

Hi,

We have an upload field which allows jpgs, gifs and pdfs.

If the upload is a PDF it will be direct linked (i.e. so PDF is downloaded by end user) - i.e. <a href="name.pdf">Map</a>

If the upload is an image (jpg or gif), we want it to link to a page where the image is embended, i.e. <a href="image.php">Map</a>

Is there any php IF function which lets me define an IF statement based on the file extension/file type of the upload in the field?

I think it's a long shot...

Cheers in advance,

Rob


Dave
Staff / Moderator


Jul 22, 2008, 10:00 AM

Post #2 of 2 (168 views)
Shortcut
Re: [rjbathgate] IF File type [In reply to] Can't Post

Hi Rob,

Try something like this:

<?php if ($upload['extension'] == 'pdf'): ?>

... html code for pdf files ...

<?php else: ?>

... html code for other file types ...

<?php endif; ?>

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4