views:

44

answers:

2

I know how to do the traditional "Select File..." and then "Upload" mechanism for uploading files. I would like to know if there is a way to do this using single input control. Part of the motivation for this is that nobody selects a file without wanting to upload it, so why should people have to two-step the process?

I know that there are some Flash solutions; I'm not opposed to using Flash but would like to know if this problem can be solved without it. I am thinking that it would operate very similarly to the way Gmail uploads its own attachments.

The application for this is a photo uploader; the user would click on the control, a file selection dialog would pop up, the user would select the file, and then the upload process would initiate, placing the photo somewhere on the page.

There have been several questions posted similar to this, here on stackoverflow and elsewhere on the web. Many times the answer has been: "NO! IT'S A SECURITY ISSUE!" but with no explanation of why this is a security issue. If this is a security issue, why is it a security issue?

A: 

Have a look at single-step gmail like upload

Sarfraz
A: 

Hello, this is possible to simulate an "Ajax" upload like specified here. Associated with a "onchange" event on the input, that will start the upload. And to style the input type="file" like explained here so that it looks like a single button.

Fabien Ménager