 |

rjbathgate
User
Jul 21, 2008, 5:59 PM
Post #1 of 2
(213 views)
Shortcut
|
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
|
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
|
|
|  |
|