-1

that's my code :

 <script type="text/javascript">
  $(document).ready(function(){
   $("#<%=fileUpload.ClientID%>").change(function () {
    alert(// width + height ); 
    });
    });
   </script>

<asp:FileUpload ID="fileUpload" runat="server" class="upload"   />

Can i get the width and height of uploaded image from client side ??

1 Answer 1

1

How would you get the attributes of the image before the image is uploaded ? How could you be sure its even an image ? The client or server does not know anything about the file prior to upload. As far as I know, you can only get the name and size of the file.

7
  • that's just a peace of my code i can detect the type of the uploaded image but how can i check for it's width and height ? Commented Sep 4, 2012 at 11:08
  • Like I said, before the image is uploaded, you can't get anything else than file size and name. By "detecting" do you mean using a filter for the file selection dialog ? That is far from a bulletproof detection method. Commented Sep 4, 2012 at 11:13
  • check this link jsfiddle.net/4N6D9/1 it's not working for me maybe because i'm using an asp control but i want a different solution Commented Sep 4, 2012 at 11:15
  • For the third time: the file needs to be uploaded for this to work Commented Sep 4, 2012 at 11:18
  • 1
    No. No. No. No. No. No. No. A completely different thing is if you load an existing image from the web, but getting anything else than file name and size of an image that resides in a user's drive, no. In your code, you just create an empty image and try to load if from a URL. Commented Sep 4, 2012 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.