简体   繁体   English

使用 jQuery 触发文件上传

[英]Trigger FileUpload with jQuery

I want to trigger a hidden fileupload and it works fine - except in Apple's Safari browser.我想触发隐藏的文件上传,它工作正常 - 除了苹果的 Safari 浏览器。 any idea?任何想法?

<input style="position: absolute; display: none;" id="fufile" type="file" multiple="multiple" />
<a href="#"  onclick="$('#fufile').click();return false;">open dialog</a>

http://jsfiddle.net/4W4XY/ http://jsfiddle.net/4W4XY/

This other post may help you.这篇其他帖子可能会对您有所帮助。

Programmatically trigger "select file" dialog box 以编程方式触发“选择文件”对话框

You need to use visibility:hidden instead of display:none.您需要使用可见性:隐藏而不是显示:无。

use this code:使用此代码:

$('#fufile').trigger('click');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM