Different Display when no upload
Question
In making a file upload optional, when someone decides not to upload a file, is there a way to make the display page appear without that broken gif image? Maybe with words that say, "image not provided" - something like that....
DISCLAIMER:
This is extra complimentary content which purpose is to show additional usage that is not part of the product, i.e. it suggests tips for extending the functionality of the product by the users themselves.
It is provided "as is", without warranty of any kind, express or
implied , including but not limited to the warranties of
merchantability, fitness for a particular purpose and nonfringement of
third party rights.
DMXzone does not take responsibility to
support the suggested content to be fully compatible and working as
intended and does not provide support for extended functionality which
is not included in the current release of the extension.
It is highly recommended that only more advanced developers use it.
Try the following code:
<% if myRecordset.Fields.Item("ImageFileName").Value <> "" then %>
<IMG src="/upload/<%=myRecordset.Fields.Item("ImageFileName").Value%>">
<% else ' no image %>
Image Not Provided
<% end if ' image check %>
Comments
another solution
I use an extension from the robgt, so you dont get a broken image.
<%
' *** Show Image If Available
' *** RobGT Server Behaviour 107 - By RobGT - www.robgt.com ***
IF (Recordset1.Fields.Item("news_pic").Value) <> "" Then%>
<img src = "<%=(Recordset1.Fields.Item("news_pic").Value)%>">
<% End IF %>
where i must put this code?
where i must put tis code? i have same problem, upload is optional, but if no have a image or file insert or update behavior not work
hi
Image does not show up
RE: another solution
I must be doing somethin terribly wrong. I have a page that I created in ASP. Its a detail page that has 3 images with recordsets. Now when I view the page normally, it views fine. When I have no image uploaded, it displays the empty image box. No when I tried to apply the Server Behvior #107 that you used above, I get 3 more image boxs. So Tried the other method the if else one way above, and what happens is it works fine, except when an image should be displyed I get a broken image. The url to the image is missing.
http://www.website/image/?
What the hell am I doing wrong. I tried using dreamweavers show if not empty but that didnt do anything either.
my email is rdcano@attbi.com
Thanks
You must me logged in to write a comment.