Hi,
I have a problem regarding displaying the files. Actually, my code displays both pdf's and images. I am thinking to have a script to check whether the file is image or pdf before it gets displayed. Can anyone help in this regard.
Thanks,
Rohith

Recommended Answers

All 4 Replies

this isn't very clear. But with only this information i would say check the file extensions on the path. if its .PDF then obviously, and if its .jpeg, .gif, .png, .bmp, ect. then its an image.

if(filename.EndsWith(".pdf"))
{
        //open pdf
}
else if(filename.EndsWith(".jpeg"))
{
       // open jpeg
}
else {
     //Open as text
}
if(filename.EndsWith(".pdf"))
{
        //open pdf
}
else if(filename.EndsWith(".jpeg"))
{
       // open jpeg
}
else {
     //Open as text
}

Hi,
Actually i have written a handler class to deal with thumbnails and fullimages. Can you tell me how can i write a code in thumbnail handler class. I want to check the file before displaying the thumbnail, if the file is pdf then it should be displayed as it is with out being displayed as a thumbnail.
Thanks,
rohith

Path.GetExtension(filePath); can also be used to return the file type extension.
If you have written a class then i expect your class has a method which reads the file and returns a thumbnail, since thats the behaviour you wish to alter, you can place the above code inside that method. Check the filetype then return a thumbnail based on the type of the file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.