简体   繁体   English

使用javascript上传文件

[英]Upload a file with javascript

How could I upload files with javascript in the same way that Gmail does? 我如何以与Gmail相同的方式上传带有javascript的文件? I want no components or jQuery plugins, I just want to understand the technique. 我不想要任何组件或jQuery插件,我只想了解这项技术。

I've found lots of articles about how to add input elements dynamically, or create fancy "marquee" progress bars, or dialogs, and also about comercial components or jQuery plugins. 我找到了很多有关如何动态添加输入元素,如何创建精美的“字幕”进度条或对话框以及商业组件或jQuery插件的文章。 I just want to accomplish the same than Gmail does. 我只想完成与Gmail相同的工作。

Thanks in advance. 提前致谢。

Gmail currently uses (hidden) Flash uploading (see http://ajaxian.com/archives/multi-file-upload-in-the-flickr-and-gmail-house ) Gmail目前使用(隐藏)Flash上​​传(请参阅http://ajaxian.com/archives/multi-file-upload-in-the-flickr-and-gmail-house

So if you want to do it like Gmail, you might want to check out SWFUpload . 因此,如果您想要像Gmail一样进行操作,则可能需要签出SWFUpload It uses javascript with a small flash object that's hidden to facilitate the upload. 它使用javascript和隐藏的小Flash对象来促进上传。 Here's an example of a regular form with an invisible SWFUpload component . 这是一个带有不可见SWFUpload组件的常规表单的示例

Pure javascript upload is not possible; 纯javascript无法上传; some server interaction is required. 需要一些服务器交互。

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

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