<bdo id='TNr5w'></bdo><ul id='TNr5w'></ul>

<i id='TNr5w'><tr id='TNr5w'><dt id='TNr5w'><q id='TNr5w'><span id='TNr5w'><b id='TNr5w'><form id='TNr5w'><ins id='TNr5w'></ins><ul id='TNr5w'></ul><sub id='TNr5w'></sub></form><legend id='TNr5w'></legend><bdo id='TNr5w'><pre id='TNr5w'><center id='TNr5w'></center></pre></bdo></b><th id='TNr5w'></th></span></q></dt></tr></i><div id='TNr5w'><tfoot id='TNr5w'></tfoot><dl id='TNr5w'><fieldset id='TNr5w'></fieldset></dl></div>

  1. <tfoot id='TNr5w'></tfoot>

    <small id='TNr5w'></small><noframes id='TNr5w'>

  2. <legend id='TNr5w'><style id='TNr5w'><dir id='TNr5w'><q id='TNr5w'></q></dir></style></legend>

    1. 创建自定义上传进度条

      Creating a custom upload progress bar(创建自定义上传进度条)

      1. <legend id='Aao9g'><style id='Aao9g'><dir id='Aao9g'><q id='Aao9g'></q></dir></style></legend>
        • <tfoot id='Aao9g'></tfoot>
            • <bdo id='Aao9g'></bdo><ul id='Aao9g'></ul>

              <small id='Aao9g'></small><noframes id='Aao9g'>

              <i id='Aao9g'><tr id='Aao9g'><dt id='Aao9g'><q id='Aao9g'><span id='Aao9g'><b id='Aao9g'><form id='Aao9g'><ins id='Aao9g'></ins><ul id='Aao9g'></ul><sub id='Aao9g'></sub></form><legend id='Aao9g'></legend><bdo id='Aao9g'><pre id='Aao9g'><center id='Aao9g'></center></pre></bdo></b><th id='Aao9g'></th></span></q></dt></tr></i><div id='Aao9g'><tfoot id='Aao9g'></tfoot><dl id='Aao9g'><fieldset id='Aao9g'></fieldset></dl></div>
                <tbody id='Aao9g'></tbody>

              1. 本文介绍了创建自定义上传进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我见过所有的上传进度条插件、小部件等——它们都很糟糕.它们要么太笨重,包含太多无用的代码,要么无法正常工作.

                I have seen all the upload progress bar plugins, widgets, etc. – they all suck. They're either too bulky with too much useless code or they don't work.

                我想知道在哪里可以阅读有关如何显示简单上传进度指示器的信息.大多数浏览器在下方都有一个状态进度条,但在与客户打交道时仅使用它不是很专业.

                What I want to know is where I can read up on how to display an easy upload progress indicator. Most browsers have a status progress bar on them below, but it isn't very professional to use just that when dealing with clients.

                浏览器是如何做到的?我想知道浏览器如何工作以指示上传状态的内部结构,以便我可以使用 PHP &jQuery.

                How does the browser do it? I want to know the internals of how the browser works with for indicating the status of something uploading so that maybe I can make something using PHP & jquery.

                谢谢.

                推荐答案

                既然要使用 PHP,那我先从 uploadprogress 扩展(默认情况下,在上传完成之前,PHP 不会为您提供任何数据;此扩展提供此类服务器端功能).请注意,它需要 PHP 5.2+,并且可能对配置选项很挑剔.另请参阅其 评论和演示和故障排除提示).PHP 文档评论中提供了一个简短的概述.

                Since you want to use PHP, I'd start with the uploadprogress extension (PHP doesn't, by default, give you any data about until the upload is completed; this extension provides such server-side functionality). Note that it requires PHP 5.2+ and can be picky about configuration options. Also see its commentary and demo and troubleshooting hints). A short overview available in PHP documentation comments.

                使用扩展程序,您可以获得一些上传统计信息;然后您可以通过 AJAX 轮询服务器并更新某种进度条.

                Using the extension, you can get some stats on the upload; then you can poll the server through AJAX and update some sort of progress bar.

                更具体一点:

                • 获取表单的唯一标识符,并将其包含在隐藏字段中
                • 上传应该在 IFRAME 中运行 - 某些浏览器不允许 DOM 更新到运行上传的同一页面
                • 通过 AJAX 轮询服务器(使用标识符指定您感兴趣的上传内容)并解析结果(IIRC,您会得到类似bytes_uploaded => 123, content-length=> 1000")
                • 更新您的进度条(显示方式由您决定,我使用x% done"加上图形条)
                • 表单上传成功后重定向整个页面

                (哦,顺便说一句,检查 PHP 的 upload_max_filesize 和 post_max_size 设置,因为它们都限制了最大上传大小)

                (Oh, and btw, check PHP's upload_max_filesize and post_max_size settings, as both limit the maximum upload size)

                这篇关于创建自定义上传进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                PHP Upload File Validation(PHP 上传文件验证)
                PHP Error - Uploading a file(PHP 错误 - 上传文件)
                How can I write tests for file upload in PHP?(如何在 PHP 中编写文件上传测试?)
                php resizing image on upload rotates the image when i don#39;t want it to(php在上传时调整图像大小会在我不想要它时旋转图像)
                How to send additional data using PLupload?(如何使用 PLupload 发送附加数据?)
                change button text in js/ajax after mp4 =gt;mp3 conversion in php(在 php 中的 mp4 =gt;mp3 转换后更改 js/ajax 中的按钮文本)

                    • <bdo id='zIZgz'></bdo><ul id='zIZgz'></ul>
                        <tfoot id='zIZgz'></tfoot>

                        <small id='zIZgz'></small><noframes id='zIZgz'>

                          <tbody id='zIZgz'></tbody>

                        <i id='zIZgz'><tr id='zIZgz'><dt id='zIZgz'><q id='zIZgz'><span id='zIZgz'><b id='zIZgz'><form id='zIZgz'><ins id='zIZgz'></ins><ul id='zIZgz'></ul><sub id='zIZgz'></sub></form><legend id='zIZgz'></legend><bdo id='zIZgz'><pre id='zIZgz'><center id='zIZgz'></center></pre></bdo></b><th id='zIZgz'></th></span></q></dt></tr></i><div id='zIZgz'><tfoot id='zIZgz'></tfoot><dl id='zIZgz'><fieldset id='zIZgz'></fieldset></dl></div>
                          <legend id='zIZgz'><style id='zIZgz'><dir id='zIZgz'><q id='zIZgz'></q></dir></style></legend>