How to check the file availability on server

  • Thread starter Thread starter Anil
  • Start date Start date
A

Anil

Hi All,

We have hundreds of images on our server. Depending on the ItemID (fetched
from database) we display the image to the client. For ex. if the ItemID is
20045 then, we display the image 20045.jpg

But for certain items, we don't have image. So, is it possible to check the
image is available or no on the server. So, if the image is not available
for certain item, then we want to display a default image for that item.

Note: it's not possible for us to add a column in the database for image
availbility status.

Pls let me know, is it possible to check the image availbility on server. If
someone has got code, then please send me.

Thanks,
Anil
 
Are the image files on the same server as the web server?? If so, you could
use FileSystemObject or System.IO and attempt to see if the file exists. If
it doesn't then show /Images/Unavailable.jpg instead.
 
Along the same lines, it is no wonder that you are NOT a professional
developer. When you're boss signs you up for a project that needs to be done
in 3 weeks (and you already have projects going on) and you have to crank
out something "reasonable" - you are going to put out some code that isn't
the prettiest. It's a trade-off, you want to make it *perfect* and a
work-of-art.... you're boss is going to want something that works, for
Tuesday....

Second of all, what was so offensive about this design?
 
Frank,
that wasn't called for. be nice.

why don't you try reading the file, if it throws an exception then catch it
and display a message, the file is not there. otherwise it is and will
displayed.
 
I didn't think that was offensive or inappropriate - but I do apologize if
you found it out of line.

For someone to make such strong statements that is CLEARLY still in the
academic world of puppydogs and ice cream and perfect code, I thought the
other side of the coin (reality) was worth mentioning... :o)
 
Back
Top