Get image width and height before upload

  • Follow


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.. 


0
Reply EnjoyNews 9/13/2008 8:24:20 AM

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
0
Reply Bart 9/13/2008 8:57:47 AM


"Bart Van der Donck" <bart@nijlen.com> skrev i en meddelelse 
news:70acd5ec-35f9-4a12-8527-51b3faf4084e@e53g2000hsa.googlegroups.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 ? 


0
Reply EnjoyNews 9/13/2008 9:12:33 AM

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
0
Reply Bart 9/13/2008 9:19:24 AM

Bart Van der Donck wrote:

> =A0 documents.forms[0].submit()

document.forms[0].submit()

--
 Bart
0
Reply Bart 9/13/2008 9:20:50 AM

4 Replies
534 Views

(page loaded in 0.099 seconds)

Similiar Articles:













7/23/2012 1:25:52 AM


Reply: