Get image width and height before upload

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • EnjoyNews

    Get image width and height before upload

    Hi

    Is it possible to somehow get the width and height of an image that is not
    uploaded yet.

    Ex.
    <input name="upload" type="file" onchange="some javascript that sends the
    width and height to a div like getElementById" >
    So when is click browse and finds an image it will write the width and
    height in a div somewhere else on the page.

    So it is before the form is submittet ?

    It would also be ok if it was a button you clicked after you have browsed
    you image.
    It just has to be before upload..


  • Bart Van der Donck

    #2
    Re: Get image width and height before upload

    EnjoyNews wrote:
    Is it possible to somehow get the width and height of an image that is not
    uploaded yet.
    >
    Ex.
    <input name="upload" type="file" onchange="some javascript that sends the
    width and height to a div like getElementById" >
    So when is click browse and finds an image it will write the width and
    height in a div somewhere else on the page.
    >
    So it is before the form is submittet ?
    >
    It would also be ok if it was a button you clicked after you have browsed
    you image.
    It just has to be before upload..
    This is impossible due to security restrictions. The only way is to
    first upload the file.

    --
    Bart

    Comment

    • EnjoyNews

      #3
      Re: Get image width and height before upload


      "Bart Van der Donck" <bart@nijlen.co mskrev i en meddelelse
      news:70acd5ec-35f9-4a12-8527-51b3faf4084e@e5 3g2000hsa.googl egroups.com...
      EnjoyNews wrote:
      >
      >Is it possible to somehow get the width and height of an image that is
      >not
      >uploaded yet.
      >>
      >Ex.
      ><input name="upload" type="file" onchange="some javascript that sends the
      >width and height to a div like getElementById" >
      >So when is click browse and finds an image it will write the width and
      >height in a div somewhere else on the page.
      >>
      >So it is before the form is submittet ?
      >>
      >It would also be ok if it was a button you clicked after you have browsed
      >you image.
      >It just has to be before upload..
      >
      This is impossible due to security restrictions. The only way is to
      first upload the file.
      >
      --
      Bart
      Thanks...

      But how can I upload the file without submitting the form ?


      Comment

      • Bart Van der Donck

        #4
        Re: Get image width and height before upload

        EnjoyNews wrote:
        ...
        But how can I upload the file without submitting the form ?
        The form must be submitted anyhow, either by a manual action of the
        user or instructed by the following javascript command:

        documents.forms[0].submit()

        (in case there is only one form on the page)

        The file must first be manually selected by the user in any case.

        --
        Bart

        Comment

        • Bart Van der Donck

          #5
          Re: Get image width and height before upload

          Bart Van der Donck wrote:
            documents.forms[0].submit()
          document.forms[0].submit()

          --
          Bart

          Comment

          Working...