Note that there are some explanatory texts on larger screens.

plurals
  1. POProgress bar in uploading files using URL
    primarykey
    data
    text
    <p>I am uploading files through URL in PHP, ajax. I need a progress bar that shows how much file has been uploaded.</p> <p>Please see what I am using in my code.</p> <p>PHP code</p> <pre><code>$upload_url = $_REQUEST['upload_url']; $arr_upload_file = explode("/",$upload_url); $ext = $arr_upload_file[count($arr_upload_file)-1]; $file = md5(mt_rand(0,1000) . implode(getdate()) . $ext) . '-' . $ext; //echo $_SERVER['] $app-&gt;sessions-&gt;get_var('folder_id'); $path = 'C:/wamp/www/bigoshare/uploads/'; $uploadss = file_put_contents($path.$file,file_get_contents($upload_url)); $size = getimagesize($path.$file); $totsize = strlen(file_get_contents($upload_url)); </code></pre> <p>Ajax code</p> <pre><code>$('#url_upload_btn').live('click', function () { $('#progress_container').fadeIn(100); //fade in progress bar $('#progress_bar').width("50%"); //set width of progress bar based on the $status value (set at the top of this page) $('#progress_completed').html("50%"); upload_url = $('#txt_url_link').val(); setInterval("getinterdata()", 1000); var dataString = 'upload_url=' + upload_url; $.ajax({ url: App.url + '/allusers/uploadbyurl/', type: 'GET', data: dataString, success: function (data) { $('#uploads').prepend($.trim(data)); $('.show_url_Upload_div').hide(); } }); }); function getinterdata() { $.ajax({ url: App.url + '/allusers/getuploadpercentage/', type: 'GET', success: function (data) { console.log(data); } }); } </code></pre> <p>When I am executing the above code seconde ajax only responds after the complete upload of file while i need at the time of uploading and in progress.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload