|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Check if file exists, else...
<i><b>Originally posted by : daveschool (daveschool@hotmail.com)</b></i><br />I am trying to find the code which enables me to display a .jpg image depending on the existence of a variable filename. I have tried several variations on the 'If FileSystemObject.FileExists()' theme without success. Can anyone help?<br /><br />The database is Access 97, the recordset is 'rst' and the field is "Ref", containing names of images minus the .jpg extension. Images are stored in folder 'images'.<br /><br />Is this close? (It doesn't work.) <br /><br /><table border=0 cellspacing=10 cellpadding=6><br /><%<br /><br />dim fso<br />Set fso = server.CreateObject("Scripting.FileSystemObject")<br /><br /> If (fso.FileExists("images
opic.jpg")) Then<br /> pic=rst("ref")<br /> Else<br /> pic="nopic"<br /> End If<br /><br />Do while not rst.EOF<br /><br />Response.write "<tr><td valign=top><img src=images""?c&".jpg></td>"_<br />&"<td valign=top>"&rst("description")&" - Ref: "&rst("ref")&"</td>"_<br />&"</tr>" <br />rst.MoveNext<br />Loop<br /><br />%><br /><br /></table><br /><br />Help appreciated.<br /> |
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : j</b></i><br />If IsNull(rst("ref")) then<br /> 'It is null<br />else<br /> 'It is not null<br />end if<br /><br />OR<br /><br />if rst("ref") & "" = "" then<br /> 'It is null<br />else<br /> 'It is not null<br />end if<br /><br /><br />------------<br />daveschool at 2/26/2000 5:42:57 PM<br /><br />I am trying to find the code which enables me to display a .jpg image depending on the existence of a variable filename. I have tried several variations on the 'If FileSystemObject.FileExists()' theme without success. Can anyone help?<br /><br />The database is Access 97, the recordset is 'rst' and the field is "Ref", containing names of images minus the .jpg extension. Images are stored in folder 'images'.<br /><br />Is this close? (It doesn't work.) <br /><br /><table border=0 cellspacing=10 cellpadding=6><br /><%<br /><br />dim fso<br />Set fso = server.CreateObject("Scripting.FileSystemObject")<br /><br /> If (fso.FileExists("images
opic.jpg")) Then<br /> pic=rst("ref")<br /> Else<br /> pic="nopic"<br /> End If<br /><br />Do while not rst.EOF<br /><br />Response.write "<tr><td valign=top><img src=images""?c&".jpg></td>"_<br />&"<td valign=top>"&rst("description")&" - Ref: "&rst("ref")&"</td>"_<br />&"</tr>" <br />rst.MoveNext<br />Loop<br /><br />%><br /><br /></table><br /><br />Help appreciated.<br /> |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Check if file exists, else... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|