Image upload dimensions
-
I'm trying to validate an image before uploading to the server. Basically I want to validate the image width and height before uploading. I have seen this done before using javascript but thought maybe someone would have another solution?
ASP all the way
-
I'm trying to validate an image before uploading to the server. Basically I want to validate the image width and height before uploading. I have seen this done before using javascript but thought maybe someone would have another solution?
ASP all the way
Well if you want it done prior to uploading then I'm afraid that javascript is your only method. Can't access a file server side without it being there after all. Of course people disabling javascript would get around this so, you should really have a redundant check on the server side anyway.
-
I'm trying to validate an image before uploading to the server. Basically I want to validate the image width and height before uploading. I have seen this done before using javascript but thought maybe someone would have another solution?
ASP all the way
In Asp.NET you can check image file's height and width before uploading it using following code.
Dim upBmp As Bitmap = Bitmap.FromStream(FileUpload1.PostedFile.InputStream)
Dim upWidth As Integer = upBmp.Width
Dim upHeight As Integer = upBmp.HeightBut for that you need server trip. So best way is using javascript. HTH
Jinal Desai - LIVE Experience is mother of sage....
-
Well if you want it done prior to uploading then I'm afraid that javascript is your only method. Can't access a file server side without it being there after all. Of course people disabling javascript would get around this so, you should really have a redundant check on the server side anyway.
thanks i see the problem. thanks for the advice tho.
ASP all the way
-
In Asp.NET you can check image file's height and width before uploading it using following code.
Dim upBmp As Bitmap = Bitmap.FromStream(FileUpload1.PostedFile.InputStream)
Dim upWidth As Integer = upBmp.Width
Dim upHeight As Integer = upBmp.HeightBut for that you need server trip. So best way is using javascript. HTH
Jinal Desai - LIVE Experience is mother of sage....
I'll try this method and see if it works for my scenario. thanks
ASP all the way