Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > *NIX системы: Общие вопросы > nginx+uploadprogress


Автор: alligator 24.12.2011, 22:38
Народ кто настраивал прогресс загрузки файлов, никак не могу настроить....... как работает этот алгоритм кто может подсказать?
пользуюсь образцами из примеров пока результат 0...... (((
Код

    server {

        listen *:80 default;
        server_name name;    
        access_log /var/log/nginx/localhost.access_log main;
        error_log /var/log/nginx/localhost.error_log info;
        root /var/www/localhost/htdocs;

        charset  windows-1251;
        location ~ \.php$ {

    fastcgi_connect_timeout 90;
    fastcgi_send_timeout 60;
    fastcgi_read_timeout 120;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 4 256k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_intercept_errors on;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
   }

location /get {
            # proxy to upstream server
            proxy_pass http://127.0.0.1;
            proxy_redirect default;
            # track uploads in the 'proxied' zone
            # remember connections for 30s after they finished
            track_uploads proxied 30s;
        }
        
        location ^~ /progress {
            # report uploads tracked in the 'proxied' zone
            report_uploads proxied;
        }

    }



Код

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>ajaxFileUpload</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="../lib/jquery.js"></script>
        <script src="../jquery.uploadProgress.js"></script>
        <script type="text/javascript">
            $(function() {
                $('form').uploadProgress({
                    /* scripts locations for safari */
                    jqueryPath: "../lib/jquery.js",
                    uploadProgressPath: "../jquery.uploadProgress.js",
                    start:function(){},
                    uploading: function(upload) {$('#percents').html(upload.percents+'%');},
                    interval: 2000
                });
            });
        </script>
        <style type="text/css">
            .bar {
              width: 300px;
            }

            #progress {
              background: #eee;
              border: 1px solid #222;
              margin-top: 20px;
            }
            #progressbar {
              width: 0px;
              height: 24px;
              background: #333;
            }
        </style>
    </head>

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

        <div id="uploading">
          <div id="progress" class="bar">
            <div id="progressbar">&nbsp;</div>
          </div>
        </div>
        <div id="percents"></div>
    </body>
</html>


Автор: bilbobagginz 31.12.2011, 09:42
вот офиц. инструкция:
http://wiki.nginx.org/HttpUploadProgressModule
какой этап пропустил ?
на каком этапе возникли грабли ?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)