0

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

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Geekitygeek
0

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.

0
if(filename.EndsWith(".pdf"))
{
        //open pdf
}
else if(filename.EndsWith(".jpeg"))
{
       // open jpeg
}
else {
     //Open as text
}
0
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

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.