在服务器进度条pecl上下载文件

时间:2011-11-28 10:44:35

标签: php ajax jquery nginx

我正在使用这个插件https://github.com/drogus/jquery-upload-progress的nginx上传模块(http://www.grid.net.ru/nginx/upload.en.html)通过进度条成功上传我服务器上的文件。这是我的表格:

<form id="upload" enctype="multipart/form-data" action="/upload/" method="post">
    <input type="file" name="file_1">
        <input type="submit" value="Upload">
</form>

现在我想使用一个选项来下载带有进度条的远程文件,所以我的表单是这样的:

<form id="download" action="/upload/" method="post">
    <textarea rows="2" cols="20" name="links"></textarea>
        <input type="submit" value="Upload">
</form>

因此,如果我在链接textarea中提供http://domain.com/file.zip文件,并在点击提交后,它应显示我下载文件的进度条。

我注意到我的第一个上传方法是从链接(http://domain.com/progress?X-Progress-ID=0c1ecb6da3f3ffc3848ceb337541ab1d)生成的一些数据,对于正在上传的文件,但我不确定是否我可以用它来显示下载进度条:

new Object({ 'state' : 'uploading', 'received' : 674808, 'size' : 2028876 } )

感谢您的帮助。 最诚挚的问候

编辑修正

在这里找到解决方案,https://gist.github.com/1030450需要使用curl,保存文件中的进度,然后使用ajax调用以获取当前进度...稍后将发布我的解决方案:)

1 个答案:

答案 0 :(得分:1)

在这里找到解决方案,https://gist.github.com/bdunogier/1030450需要使用curl,保存文件中的进度,然后使用ajax调用以获取当前进度。