显示负载输入文件对话框? [英] Show input file dialog on load?

查看:116
本文介绍了显示负载输入文件对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个对话框,改变图像。而不是让用户单击文件输入字段我希望它立即恢复。输入字段是一个简单的:

I'm making a dialog for changing an image. Instead of having the user to click the file input field I want it to be brought up immediately. The input field is simply a:

<input type="file">

有没有显示它页面加载时的方式?

Is there a way to display it when page is loaded?

奖励积分,如果有做它的角方式。

Bonus points if there is an angular way of doing it.

推荐答案

如上所述<一个href=\"http://stackoverflow.com/questions/210643/in-javascript-can-i-make-a-click-event-fire-programmatically-for-a-file-input\">here只有Internet Explorer允许的文件上传对话框的纲领性开幕。
所以,简单的答案是否定的,有没有办法自动打开在页面加载的文件上传对话框。

As described here only Internet Explorer allows for programmatic opening of the File Upload dialog. So the short answer is no, there is no way to automatically open the File Upload dialog on page load.

这是你可能会考虑长的答复是,当用户点击<一个可以显示它href=\"http://stackoverflow.com/questions/8928386/jquery-trigger-click-not-working-on-safari-browsers-in-mac-ipad-iphone/8991665#8991665\">anything.
你preFER一个AngularJS的解决方案,这一事实告诉我们,你在写一个单页的应用。另外,我不认为你需要显示文件上传对话框时,应用程序首次加载。你最有可能需要它显示的之后的一些用户交互 - 上的东西在用户点击后。那东西,利用这里 的一个AngularJS指令,可能看起来像什么,但有一个文件输入。在点击(同一用户交互),您也可以切换到另一路在你的AngularJS应用,有效地模拟用户导航到另一个页面,并自动presenting他的文件上传对话框。

The long answer that you might consider is that you can show it when the user clicks on anything. The fact that you prefer an AngularJS solution tells us that you are writing a Single Page Application. Also, I don't think you need to show the File Upload dialog when the app first loads. You most likely need it to show after some user interaction - after the user clicks on something. That something, using the an AngularJS directive from here, could look like anything but be a file input. On click (the same user interaction) you can also switch to another route in your AngularJS app, effectively simulating a user navigating to another page and automatically presenting him the File Upload dialog.

这篇关于显示负载输入文件对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆