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.

Recommended Answers

All 2 Replies

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.

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

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.