[jQuery] Re: get an image from an input field just with javascript

2008-09-18 Thread ^AndreA^

yeah, unfortunately you are both right... :-|

In fact I was afraid to receive this answer...

Anyway, how can I upload the image just with js and without submitting
the form?

jQuery standard function ($.ajax) does not seem to allow a file/image
as a file type...

I also looked to some plugins and they allow just xml,json...

Have you got any idea about what I can use?

Thanks,
Andrea

On Sep 17, 6:53 pm, tlphipps [EMAIL PROTECTED] wrote:
 You could certainly accomplish this with a little bit of AJAX thrown
 in.

 Scenario:
 - user selects image (using input type='file')
 - user clicks 'preview' button
 - system submits selected image file via AJAX to server
 - server processes image upload and stores file on server
 - In the AJAX 'success' handler, create new img tag on page which
 references newly stored image file on server.

 On Sep 17, 12:04 pm, config [EMAIL PROTECTED] wrote:

  You can't view the file because of security restrictions.

  A *long* time ago one could grab the path and call it with the file://
  protocol, but this is now blocked in most (all?) browsers. Similarly,
  one can't write a path into the file input.

  G.


[jQuery] Re: get an image from an input field just with javascript

2008-09-18 Thread ^AndreA^

yeah, unfortunately you are both right... :-|

In fact I was afraid to receive this answer...

Anyway, how can I upload the image just with js and without submitting
the form?

jQuery standard function ($.ajax) does not seem to allow a file/image
as a file type...

I also looked to some plugins and they allow just xml,json...

Have you got any idea about what I can use?

Thanks,
Andrea

On Sep 17, 6:53 pm, tlphipps [EMAIL PROTECTED] wrote:
 You could certainly accomplish this with a little bit of AJAX thrown
 in.

 Scenario:
 - user selects image (using input type='file')
 - user clicks 'preview' button
 - system submits selected image file via AJAX to server
 - server processes image upload and stores file on server
 - In the AJAX 'success' handler, create new img tag on page which
 references newly stored image file on server.

 On Sep 17, 12:04 pm, config [EMAIL PROTECTED] wrote:

  You can't view the file because of security restrictions.

  A *long* time ago one could grab the path and call it with the file://
  protocol, but this is now blocked in most (all?) browsers. Similarly,
  one can't write a path into the file input.

  G.


[jQuery] Re: get an image from an input field just with javascript

2008-09-18 Thread tlphipps

I've never done it, but I know of two scripts which support it:

1) http://www.phpletter.com/Demo/AjaxFileUpload-Demo/
2) http://malsup.com/jquery/form/#code-samples (file uploads tab)

On Sep 18, 7:22 am, ^AndreA^ [EMAIL PROTECTED] wrote:
 yeah, unfortunately you are both right... :-|

 In fact I was afraid to receive this answer...

 Anyway, how can I upload the image just with js and without submitting
 the form?

 jQuery standard function ($.ajax) does not seem to allow a file/image
 as a file type...

 I also looked to some plugins and they allow just xml,json...

 Have you got any idea about what I can use?

 Thanks,
 Andrea

 On Sep 17, 6:53 pm, tlphipps [EMAIL PROTECTED] wrote:

  You could certainly accomplish this with a little bit of AJAX thrown
  in.

  Scenario:
  - user selects image (using input type='file')
  - user clicks 'preview' button
  - system submits selected image file via AJAX to server
  - server processes image upload and stores file on server
  - In the AJAX 'success' handler, create new img tag on page which
  references newly stored image file on server.

  On Sep 17, 12:04 pm, config [EMAIL PROTECTED] wrote:

   You can't view the file because of security restrictions.

   A *long* time ago one could grab the path and call it with the file://
   protocol, but this is now blocked in most (all?) browsers. Similarly,
   one can't write a path into the file input.

   G.


[jQuery] Re: get an image from an input field just with javascript

2008-09-17 Thread config

You can't view the file because of security restrictions.

A *long* time ago one could grab the path and call it with the file://
protocol, but this is now blocked in most (all?) browsers. Similarly,
one can't write a path into the file input.

G.


[jQuery] Re: get an image from an input field just with javascript

2008-09-17 Thread tlphipps

You could certainly accomplish this with a little bit of AJAX thrown
in.

Scenario:
- user selects image (using input type='file')
- user clicks 'preview' button
- system submits selected image file via AJAX to server
- server processes image upload and stores file on server
- In the AJAX 'success' handler, create new img tag on page which
references newly stored image file on server.

On Sep 17, 12:04 pm, config [EMAIL PROTECTED] wrote:
 You can't view the file because of security restrictions.

 A *long* time ago one could grab the path and call it with the file://
 protocol, but this is now blocked in most (all?) browsers. Similarly,
 one can't write a path into the file input.

 G.