基于Ajax的文件上传 [英] Ajax based File Uploads

查看:56
本文介绍了基于Ajax的文件上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找基于javascript/ajax的文件上传.它的工作方式是这样的:

I'm looking for a javascript/ajax based file upload. The way it would work is this:

1)用户单击浏览

2)用户选择CTRL并选择要上传的文件

2) User selects CTRL and selects the files he wants to upload

3)通过Javascript向用户显示一些加载图形(每个上传的文件1个)

3) Via Javascript the user is shown a few loading graphics (1 per each file being uploaded)

4)每次上传完成后,将加载图形替换为成功图形和上传文件的文件名.

4) After each upload finishes, a loading graphic is replaced with a success graphic and the filename of the uploaded file.

所以我真正想要的是:

1)一种基于javascript/ajax的文件上传方式.

1) A way to do javascript/ajax based file uploads.

2)一种检测文件何时开始/结束上传或在文件发生时调用函数的方法.

2) A way to detect when a file starts/finishes uploading, or to call a function when it happens.

推荐答案

我最近遇到了类似的问题.我们一直在使用Uploadify(http://www.uploadify.com/)进行上传.我写了一篇有关如何使用Uploadify执行多个文件上传的博客文章:

I recently faced a similar problem. We had been using Uploadify (http://www.uploadify.com/) to do uploads. I wrote a blog post on how to use Uploadify to perform multiple file uploads:

http://blog.bobcravens .com/2011/03/upload-multiple-files-with-progress-using-uploadify/

有两个受支持的选项:

  • 使用单个"input"元素并选择多个文件.

  • Use a single 'input' element and select multiple files.

使用多个输入"元素来分别选择一个文件.

Use multiple 'input' elements to select a single file each.

希望这会有所帮助.

鲍勃

这篇关于基于Ajax的文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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