0

after saving a image in a folder at runtime how to get its height and width in asp.net.
i am writing this code:

string filesavepath = AppDomain.CurrentDomain.BaseDirectory + "\\admin\\fullimages\\";
System.Drawing.Imagefullsizeimg=System.Drawing.Image.FromFile("AppDomain.CurrentDomain.BaseDirectory" + filesavepath );

this code gives me following error:
System.NotSupportedException: The given path's format is not supported.

i m not able to understand where i m wrong
someone please help.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by malashukla
0

Obviously it's giving error because you have passed wrong path/location in FromFile(). You are already storing full image path in filesavepath variable then why are you passing again AppDomain.CurrentDomain.BaseDirectory along with filesavepath in FormFile() method..

Anotherthing AppDomain is Class you can't use it like string with double quotes..

Your code should looks like below

System.Drawing.Image fullsizeimg=System.Drawing.Image.FromFile(filesavepath );

try by this and let us know...

after saving a image in a folder at runtime how to get its height and width in asp.net.
i am writing this code:

string filesavepath = AppDomain.CurrentDomain.BaseDirectory + "\\admin\\fullimages\\";
System.Drawing.Imagefullsizeimg=System.Drawing.Image.FromFile("AppDomain.CurrentDomain.BaseDirectory" + filesavepath );

this code gives me following error:
System.NotSupportedException: The given path's format is not supported.

i m not able to understand where i m wrong
someone please help.

0

Thanks for letting me know my error.
Your code works well and i have got a appropriate output.
thanks really.

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.