简单的跨浏览器,带进度条的jQuery / PHP文件上传 [英] Simple cross-browser, jQuery/PHP file upload with progress bar

查看:340
本文介绍了简单的跨浏览器,带进度条的jQuery / PHP文件上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这里有几个主题,但没有一个提供了一个文件上传脚本的明确解决方案:


  1. 在IE7 +上工作

  2. 有一个进度条(在每个浏览器上)
  3. 没有Flash(或后备)

任何解决方案?

您可以使用 Axuploader by AlbanX。它有;


  • 在所有浏览器上多文件上传

  • 多文件选择html5浏览器不是IE)

  • 在html5浏览器上上传进度信息

  • html5浏览器上的文件大小信息
  • ,没有其他插件上的Silverlight,只有JavaScript

  • 支持IE 6+,Firefox 2+,Safari 2+,Chrome 1 +
  • 不依赖于服务器最大发布大小和最大上传文件大小限制


    您也可以尝试通过Widen Fine-Uploader 。它具有;


    • FF,Chrome和Safari中的多个文件选择,进度条

    • 在FF,Chrome和Safari(OS X)中拖放文件选择

    • 上传可被取消
    • 如果没有外部依赖关系使用FineUploader或FineUploaderBasic。如果使用可选的jQuery包装器,jQuery当然是必需的。

    • FineUploaderBasic只需要关联的Fine Uploader javascript文件。所有美好的上传者css和图像文件可以省略。
    • 不使用Flash

    • 完全使用HTTPS

    • 在IE7 +,Firefox,Safari(OS X),Chrome,IOS6和各种版本的Android上进行测试。现在也支持IE10!
    • 能够在选择文件后立即上传文件,或者稍后按照用户请求上传文件进行上传


    • 能够自动重试失败的上传
    • 允许用户手动重试上传失败
    • 创建您自己的文件验证器和/或使用一些默认的验证器包括Fine Uploader

    • 在不同阶段接收回调上传过程

    • 发送服务器端的任何参数以及每个文件。

    • 通过拖放(Chrome 21 +)上传目录。 >
    • 在查询字符串或请求正文中包含参数。
    • 提交要通过API上传的文件。

    • 将文件拆分为多个请求(文件分块/分区)。
    • 恢复上次会话中失败/停止的上传

    • 删除已上传文件

    • CORS支持

    • 通过API上传任何Blob对象。

    • 轻松设置并强制执行最大化项目限制。

    • 通过粘贴上传图片(Chrome)。
    • 独立文件&文件夹拖动&下拉模块。默认集成到FineUploader模式中。
    • 在影响关联文件的回调中执行异步(非阻塞)任务。
    • 直接从移动设备的摄像头
    • 检索上传文件的统计信息并接收状态更改的回调

    • 还有更多!



    jQuery-File-Upload插件 (与IE兼容),它有;


    • 多文件上传:
      允许一次选择多个文件并同时上传。

    • 拖放&删除支持:
      允许通过从桌面或文件管理器拖动文件并将它们放到浏览器窗口上来上传文件。
    • 上传进度条:
      显示进度条表示单个文件和所有上传文件的上传进度。
    • 可取消的上传文件:
      单个文件上传可以取消以停止上传进度。
    • 可恢复的上传:
      支持Blob API的浏览器可以恢复中止的上传。
    • 上传的块:
      大文件可以上传到更小的块支持Blob API的浏览器。
    • 客户端图像调整大小:
      支持所需JS API的浏览器可以在客户端自动调整图像大小

    • 预览图像:
      使用支持所需JS API的浏览器上传图片前,可以显示图片文件。

    • 不需要浏览器插件(例如Adobe Flash) :
      实现基于op如HTML5和JavaScript,并且不需要额外的浏览器插件。
    • 传统浏览器的优雅回退:
      如果受支持,则通过XMLHttpRequests上传文件,并使用iframe作为旧版浏览器的回退。 / li>
    • HTML文件上传表单后备:
      如果禁用JavaScript,则显示标准HTML文件上传表单。 跨站点文件上传:
      支持使用跨站点XMLHttpRequests将文件上传到其他域。

    • 多个插件实例:
      允许在同一网页上使用多个插件实例。

    • 可自定义和可扩展:
      提供一个API来设置各个选项,并为各种上传事件定义callBack方法。
    • 多部分和文件内容流上传:
      文件可以作为标准的multipart / form-data或文件内容流(HTTP PUT文件上传)进行上传。
    • 与任何服务器端应用程序平台兼容:
      适用于任何服务器端(PHP,Python,Ruby on Rails,Java,Node.js,Go等)支持标准的HTML表单文件上传。


      *更新



      查看 10使用jQuery示例上传HTML5文件 可以查看HTML5中的一些优秀文件上传程序 > 10+ PHP Ajax上传文件教程 - 免费下载 你可以从很多上传者中选择。



      希望这有助于。


      I know there are several topics out there about this, but none of them offered a definite solution for a file uploader script that:

      1. Works on IE7+
      2. Has a progress bar (On every browser)
      3. No Flash (Or fallback)

      Any solutions?

      解决方案

      You may use Axuploader by AlbanX. It has got;

      • Multi file upload on all browsers
      • Multi file select on html5 browsers (not IE)
      • Upload progress information on html5 browsers
      • File size information on html5 browsers
      • No flash, no Silverlight, on other plugins, only JavaScript
      • Support IE 6+, Firefox 2+, Safari 2+, Chrome 1+
      • Upload files by chunk, for more performance
      • Not dependent by server max post size and max upload file size limits

      You may also try Fine-Uploader by Widen. It has got;

      • Multiple file select, progress-bar in FF, Chrome, and Safari
      • Drag-and-drop file select in FF, Chrome, and Safari (OS X)
      • Uploads are cancelable
      • No external dependencies at all if using FineUploader or FineUploaderBasic. If using the optional jQuery wrapper, jQuery is of course required.
      • FineUploaderBasic only requires the associated Fine Uploader javascript file. All Fine Uploader css and image files can be omitted.
      • Doesn't use Flash
      • Fully working with HTTPS
      • Tested in IE7+, Firefox, Safari (OS X), Chrome, IOS6, and various versions of Android. IE10 is now also supported!
      • Ability to upload files as soon as they are selected, or "queue" them for uploading at user's request later
      • Display specific error messages from server on upload failure (hover over failed upload item)
      • Ability to auto-retry failed uploads
      • Option to allow users to manually retry a failed upload
      • Create your own file validator and/or use some default validators include with Fine Uploader
      • Receive callback at various stages of the upload process
      • Send any parameters server-side along with each file.
      • Upload directories via drag and drop (Chrome 21+).
      • Include parameters in the query string OR the request body.
      • Submit files to be uploaded via the API.
      • Split up a file into multiple requests (file chunking/partitioning).
      • Resume failed/stopped uploads from previous sessions
      • Delete uploaded files
      • CORS support
      • Upload any Blob objects via the API.
      • Easily set and enforce a maximum item limit.
      • Upload images via paste (Chrome).
      • Standalone file & folder drag & drop module. Integrated by default into FineUploader mode.
      • Perform async (non-blocking) tasks in callbacks that influence the associated file or files
      • Upload images directly from a mobile device's camera
      • Retrieve statistics for uploaded files and receive callbacks on status changes
      • And many more!

      Or jQuery-File-Upload plugin (compatible with IE), which has got;

      • Multiple file upload: Allows to select multiple files at once and upload them simultaneously.
      • Drag & Drop support: Allows to upload files by dragging them from your desktop or filemanager and dropping them on your browser window.
      • Upload progress bar: Shows a progress bar indicating the upload progress for individual files and for all uploads combined.
      • Cancelable uploads: Individual file uploads can be canceled to stop the upload progress.
      • Resumable uploads: Aborted uploads can be resumed with browsers supporting the Blob API.
      • Chunked uploads: Large files can be uploaded in smaller chunks with browsers supporting the Blob API.
      • Client-side image resizing: Images can be automatically resized on client-side with browsers supporting the required JS APIs.
      • Preview images: A preview of image files can be displayed before uploading with browsers supporting the required JS APIs.
      • No browser plugins (e.g. Adobe Flash) required: The implementation is based on open standards like HTML5 and JavaScript and requires no additional browser plugins.
      • Graceful fallback for legacy browsers: Uploads files via XMLHttpRequests if supported and uses iframes as fallback for legacy browsers.
      • HTML file upload form fallback: Shows a standard HTML file upload form if JavaScript is disabled.
      • Cross-site file uploads: Supports uploading files to a different domain with Cross-site XMLHttpRequests.
      • Multiple plugin instances: Allows to use multiple plugin instances on the same webpage.
      • Customizable and extensible: Provides an API to set individual options and define callBack methods for various upload events.
      • Multipart and file contents stream uploads: Files can be uploaded as standard "multipart/form-data" or file contents stream (HTTP PUT file upload).
      • Compatible with any server-side application platform: Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.

      *UPDATE

      Check out 10 HTML5 File Upload with jQuery Example to see some great file uploaders which works with HTML5

      Also, here at 10+ PHP Ajax Upload File Tutorials - Free Download you can choose from a lot of uploaders.

      Hope this helps.

      这篇关于简单的跨浏览器,带进度条的jQuery / PHP文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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