APC upload progress Problem

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • APC upload progress Problem

    Moin Jungs,

    ich hab ein Problem mit dem PHP APC-Extension. Ich möchte einen Progressbar in mein Uploadformualar einbauen. Ich hab nur folgendes Problem. Die Funktion apc_fetch gibt erst Daten aus, wenn der Upload fertig ist.

    Da mein Quellcode recht umfangreich ist, versuche ich nur die relevanten Passagen zu posten.

    Das Forumalar wird mittels Smarty generiert:

    Source Code

    1. $smarty->assign('temp_upload_key', uniqid());
    2. $smarty->display('upc.html');


    progress.php

    Source Code

    1. <?php
    2. $array = apc_fetch("upload_{$_GET['tid']}");
    3. print_r($_GET);
    4. print_r($array);
    5. ?>


    process.php

    Source Code

    1. <?php
    2. echo "upload finished!";
    3. ?>


    upc.html

    Source Code

    1. ...
    2. <script type="text/javascript">
    3. var req = null;
    4. function getXMLRequestHandle(){
    5. try{
    6. req = new XMLHttpRequest();
    7. }catch (e){
    8. try{
    9. req = new ActiveXObject("Msxml2.XMLHTTP");
    10. }catch (e){
    11. try{
    12. req = new ActiveXObject("Microsoft.XMLHTTP");
    13. }catch (failed){
    14. req = "failed";
    15. }
    16. }
    17. }
    18. }
    19. function getProgress(){
    20. if(req == "failed"){
    21. alert("Fehler beim Erstellen eines XMLRequest. Deaktivieren Sie JavaScript, um diese Seite zu nutzen!");
    22. return;
    23. }
    24. if(req == null)
    25. getXMLRequestHandle();
    26. req.onreadystatechange = function(){
    27. switch(req.readyState){
    28. case 4:
    29. if(req.status == 200){
    30. document.getElementById("debug").innerHTML = req.responseText;
    31. }
    32. break;
    33. }
    34. };
    35. req.open("get", "progress.php?tid=" + document.getElementById("progress_key").value);
    36. req.send(null);
    37. }
    38. function startUpload(){
    39. window.setInterval("getProgress()", 2000);
    40. }
    41. ...
    42. <form action="process.php" target="hidden_upload" method="post" enctype="multipart/form-data">
    43. ...
    44. <input type="hidden" name="submit" value="submit"/>
    45. <p><input type="submit" value="upload!" onclick="this.disabled=true; startUpload();"/></p>
    46. <input type="hidden" name="APC_UPLOAD_PROGRESS" id="progress_key" value="{$temp_upload_key}"/>
    Display All