我想要一个<input type="file">表单元素,在用户选择文件后立即触发上传过程,而不需要用户再点击“上传”。
如何在选择文件后立即启动文件上载过程并实际异步执行文件传输?
编辑 :Uploadify看起来不错 - 除了它需要Flash上传。 如果可能的话,我想尽量避免这种情况。 要求Flash上传文件可能会成为人们试图在线获取照片的障碍。 我的目标网站受众是那些对互联网,表单等没有太多经验的人。我正在努力使这个过程尽可能简单。
I'd like to have an <input type="file"> form element that fires the upload process immediately after the user chooses a file, without the need to the user to take the second additional step of clicking "upload".
How can I start the file upload process immediately upon selecting a file and actually execute the file transfer asynchronously?
EDIT: Uploadify looks good -- except that it requires Flash to upload. I'd like to try to avoid that if possible. Requiring Flash to upload files could prove to be a roadblock to people just trying to get photos online. My target website audience is people who don't have a lot of experience with internet, forms, etc. I'm trying to make the process as simple as possible.
最满意答案
您不需要任何库。 使用id创建隐藏的iframe(visibility:hidden not display:none)。 然后将上传表单上的target属性设置为此iframe。 像往常一样触发表单提交。
You do not need any libraries. Create a hidden iframe (visibility: hidden not display:none) with an id. Then set the target property on the upload form to this iframe. Trigger the form submit as usual.
使用jQuery上传文件而不点击“上传”(Using jQuery to upload a file without clicking “Upload”)我想要一个<input type="file">表单元素,在用户选择文件后立即触发上传过程,而不需要用户再点击“上传”。
如何在选择文件后立即启动文件上载过程并实际异步执行文件传输?
编辑 :Uploadify看起来不错 - 除了它需要Flash上传。 如果可能的话,我想尽量避免这种情况。 要求Flash上传文件可能会成为人们试图在线获取照片的障碍。 我的目标网站受众是那些对互联网,表单等没有太多经验的人。我正在努力使这个过程尽可能简单。
I'd like to have an <input type="file"> form element that fires the upload process immediately after the user chooses a file, without the need to the user to take the second additional step of clicking "upload".
How can I start the file upload process immediately upon selecting a file and actually execute the file transfer asynchronously?
EDIT: Uploadify looks good -- except that it requires Flash to upload. I'd like to try to avoid that if possible. Requiring Flash to upload files could prove to be a roadblock to people just trying to get photos online. My target website audience is people who don't have a lot of experience with internet, forms, etc. I'm trying to make the process as simple as possible.
最满意答案
您不需要任何库。 使用id创建隐藏的iframe(visibility:hidden not display:none)。 然后将上传表单上的target属性设置为此iframe。 像往常一样触发表单提交。
You do not need any libraries. Create a hidden iframe (visibility: hidden not display:none) with an id. Then set the target property on the upload form to this iframe. Trigger the form submit as usual.
发布评论