How to Get File info in File Upload Control

Posted by Jayakumars under ASP.NET on 2/15/2013 | Points: 10 | Views : 4623 | Status : [Member] [MVP] | Replies : 7
Hi

How to Get File Information when i Click browse button i need show below information.

1.Filesize,Filename,File size with pixels likes this ex : 10X60

My control like this

<asp:FileUpload ID="fileuploadimages" runat="server" />

Mark as Answer if its helpful to you


Responses

Posted by: Sakthi.Singaravel on: 2/15/2013 [Member] Silver | Points: 25

Up
0
Down
FileInfo finfo = new FileInfo(Server.MapPath(MyFile));

//File Name
String fName = finfo.Name;


Regards,
Singaravel M

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 2/15/2013 [Member] Silver | Points: 25

Up
0
Down
System.Drawing.Image image = System.Drawing.Image.FromStream(fs)

String fileWidth = image.Width;
String fileHeight = image.Height;


if u need VB .Net see below link...
http://forums.asp.net/post/2378863.aspx

Regards,
Singaravel M

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 2/15/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
i need asp.net vb code but i need pixels for image width & height


above code not working....

Mark as Answer if its helpful to you

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 2/15/2013 [Member] Silver | Points: 25

Up
0
Down

Dim MainImage() As Byte

MainImage = ("Picture1", Byte()))

Dim MainMS As New System.IO.MemoryStream(MainImage)
Dim origimage As System.Drawing.Image

origimage = System.Drawing.Image.FromStream(MainMS)

Dim OriginalWidth As Int16 = origimage.Width
Dim OriginalHeight As Int16 = origimage.Height


This original size as pixels...

Regards,
Singaravel M

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 2/15/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Sakthi.Singaravel

Not working your code check this image File below.


 Download source file

Mark as Answer if its helpful to you

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 2/27/2013 [Member] Silver | Points: 25

Up
0
Down
i_view.exe provides what u are expected...
but it need local copy for that exe...

 Shell("""" + "C:\i_view32.exe" + """" + " " + """" + ImagePath + """" + " /info=" + logPath, AppWinStyle.Hide)


The log path contains all information about that image...
Then u can find pixels...

Here i attached one sample log file....

Check and let me know...
 Download source file

Regards,
Singaravel M

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 2/28/2013 [Member] Silver | Points: 25

Up
0
Down
r u got solution...?

Regards,
Singaravel M

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response