[英]Upload multiple files while navigating other pages - howto?
I'm creating a website and I'd like to allow users to upload multiple files while they navigate the website . 我正在创建一个网站,我想允许用户在浏览网站时上传多个文件。
When the upload completes, it would be nice to have a Javascipt event triggered, to allow the user to specify additional info related to the uploaded files (eg. photo location, tags, etc) anyway, the required features are: 当上传完成时,触发Javascipt事件会很好,允许用户指定与上传文件相关的其他信息(例如照片位置,标签等),所需的功能是:
How can I implement these features? 我该如何实现这些功能? Any suggestion is greatly appreciated!
任何建议都非常感谢!
Edit 编辑
In the event of using a popup window to handle uploads, how can I: 如果使用弹出窗口来处理上传,我该怎么办:
Since navigating the site will switch pages and it's unlikely that there's a full ajax navigation on your site, maybe it could help to somehow upload the files in a second popup window. 由于导航网站将切换页面,并且您的网站上不太可能有完整的ajax导航,也许它可以帮助以某种方式在第二个弹出窗口中上传文件。 Not sure how (if) it could be implemented, though, but since you need to upload multiple files at a time I'm afraid you're bound to use flash.
不知道如何(如果)它可以实现,但由于你需要一次上传多个文件,我担心你一定会使用闪存。
EDIT 编辑
So the solution could look like this: 所以解决方案可能如下所示:
When a user clicks a "select files" button you pop out a new window where he'll be able to actually select files (via flash if multifile upload is necessary). 当用户单击“选择文件”按钮时,您会弹出一个新窗口,在那里他将能够实际选择文件(如果需要多文件上传,则通过闪存)。 And to notify of upload progress use
postMessage
. 并通过
postMessage
通知上传进度。 Though postMessage isn't going to work in IE in this case, but probably you could somehow send the message to the server and from the server back to the page. 虽然在这种情况下postMessage不能在IE中工作 ,但可能你可以以某种方式将消息发送到服务器并从服务器返回到页面。
Another crazy idea is not to use a popup window, but let the user select the files on the page she was first, but once the user selects the files make all the links on the page target=_blank
to make any subsequent navigation happen in another tab. 另一个疯狂的想法是不使用弹出窗口,而是让用户选择她第一次访问的页面上的文件,但是一旦用户选择文件,就会使页面上的所有链接
target=_blank
,以便在另一个链接中进行任何后续导航标签。 I know it's hacky and not exactly user-friendly, but probably could help. 我知道它很hacky并且不完全是用户友好的,但可能会有所帮助。
In any case I would inform the user beforehand that a new window will appear in both scenarios. 在任何情况下,我都会事先通知用户在两个场景中都会出现一个新窗口。
EDIT2 EDIT2
And an even crazier idea. 还有一个更疯狂的想法。 When the user selects the files and clicks a link create an iframe which will cover the whole page and hide the original page beneath it and make the links open in the iframe.
当用户选择文件并单击链接时,创建一个iframe,该iframe将覆盖整个页面并隐藏其下方的原始页面并使链接在iframe中打开。 But it looks even more hackish and it seems you'll have much trouble with it.
但它看起来更加hackish,看起来你会遇到很多麻烦。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.