开发者

Detect when user has selected a file for upload (without timers)

开发者 https://www.devze.com 2022-12-11 10:59 出处:网络
I would like to to creat开发者_Go百科e a 2-step file uploader: Open dialog. Select one file from computer.

I would like to to creat开发者_Go百科e a 2-step file uploader:

  1. Open dialog.
  2. Select one file from computer.

I would like to eliminate the step where the user must submit the form, and instead do it automatically with JavaScript. Is there anyway to achieve it?

Thanks.


Setting an onChange event and checking for whether the ".value" of the upload field is "!= null" does the trick for me. However, accessing file upload fields programmatically is always a shaky issue, and things can change with future browser security updates. If you want to be sure, use a flash based upload component like SWFUpload.

0

精彩评论

暂无评论...
验证码 换一张
取 消