Jump to content

omdeshpande

New Members
  • Posts

    3
  • Joined

  • Last visited

omdeshpande's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah, I gave up on this method. AJAX isn't an option, because of data security. I solved this with a completely different approach. I implemented a "parallel processing via divide and rule" algorithm. More complex to implement, but much more stable and reliable. Post resume upload, I forked the code and deviated the tasks, post document upload, to another URL and then flushed that request immediately. Thereby, taking the browser out of the equation.
  2. Yeah, I gave up on this method. AJAX isn't an option, because of data security. I solved this with a completely different approach. I implemented a "parallel processing via divide and rule" algorithm. More complex to implement, but much more stable and reliable. Post resume upload, I forked the code and deviated the tasks, post document upload, to another URL and then flushed that request immediately. Thereby, taking the browser out of the equation.
  3. I'm writing a file upload script using the iframe method. At the backend, post file upload, the script does a few more things. So I'm flushing output to the browser (which goes to the iframe) as soon as the file is uploaded and then the script continues. From the Chrome console I can see that the response has been received by the browser (200 OK), but, for some reason the browser only renders it after the entire script has finished, causing quite a long delay. Why is this happening? How can I get the browser to render it immediately? I have read a number of articles, blogs and Q/A on this topic that gave me the following hints, but none of them seem to be working: - Some browsers require a minimum number of bytes to start rendering (256/1024/4096). - If closing tags are missing, browsers tend to wait for it before they start rendering. - Content length is required, otherwise the browser may be keep waiting for more data. I have the above covered, I'm I missing something else? Backend code: $r = " <!DOCTYPE html> <head> <title></title> </head> <body> <p id='response'>$response</p> <p>".str_repeat(".", 4096)."</p> </body> </html> "; ignore_user_abort(true); set_time_limit(0); ob_end_clean(); ob_start(); echo $r; header("Content-Length: ".ob_get_length()); header("Connection: close", true); header("Content-Encoding: none"); ob_end_flush(); flush(); Frontend code: var iframe = document.getElementById("uploaddocframe_" + aid); var iframeobj = (iframe.contentWindow || iframe.contentDocument); if(iframeobj.document) { var iframedocument = iframeobj.document; var response = iframedocument.getElementById("response").innerHTML; if(response == "success"){ //Do something } else { // Do something } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.