Closed (fixed)
Project:
FileField
Version:
6.x-3.7
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Dec 2010 at 16:48 UTC
Updated:
19 Dec 2010 at 20:40 UTC
I'm using FileField and ImageField together to allow user to upload either a Flash video or an Image File for a particular CCK. I want to use some PHP script in my page script to display images a certain way if they upload an image or display the flash video if they upload a flash video using FileField.
Simply I want to say if there has been a file entered in the FileField than output this code and if they have not entered a file in the FileField than that code is not outputted:
<img src="<?php print $base_path ?><?php print $node->field_page_image[0][filepath] ?>">
Something like
<?php if ($fields['field_page_image']->filepath != '') { ?>
<img src="<?php print $base_path ?><?php print $node->field_page_image[0][filepath] ?>">
<?php } ?>
I know that if statement is not correct but hoping that gets across the idea I am trying to achieve.
Comments
Comment #1
quicksketchMy preference is to check the "fid" (File ID) property when checking for an empty file. It will be either 0 or not exist at all if there is no file attached.
Comment #2
gt2001 commentedPerfect. Exactly what I needed. Thank you!
Comment #3
quicksketch