Note that there are some explanatory texts on larger screens.

plurals
  1. POajax php upload file with uploading percentage
    primarykey
    data
    text
    <p>I have simple ajax uploading form using iframe. What i want is, the loading message shows the upload percentage in <code>&lt; div id="message"&gt;&lt;/div&gt;</code></p> <p><strong>This is my javascript</strong></p> <pre><code>function start_Uploading(){ document.getElementById('message').innerHTML = 'Uploading...'; return true; } function stopUpload(success) { var result = ''; if (success == 1) document.getElementById('message').innerHTML = 'Success'; else document.getElementById('message').innerHTML = 'Failed'; } </code></pre> <p><strong>This is form</strong></p> <pre><code>&lt; div id="message"&gt;&lt;br/&gt;&lt;/div&gt; &lt; form action="upload.php" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="start_Uploading();" &gt; File:&lt; input name="myfile" type="file" size="30" /&gt; &lt; input type="submit" name="submitBtn" value="Upload" /&gt; &lt; br/&gt;&lt; iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;"&gt;&lt;/iframe&gt; &lt;/form&gt; </code></pre> <p>and the server side <strong>upload.php</strong> file is</p> <pre><code>$destination_path = getcwd().DIRECTORY_SEPARATOR; $result = 0; $target_path = $destination_path . basename( $_FILES['myfile']['name']); if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) $result = 1; sleep(1); echo "&lt;script language=\"javascript\" type=\"text/javascript\"&gt;window.top.window.stopUpload($result);&lt;/script&gt;"; </code></pre>
    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