File Upload

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

  • Guten Tag Forum,

    das ist mein gesamter Code:


    Source Code

    1. foreach($_FILES["upload"]["name"] as $key => $value)
    2. {
    3. $time_var=time();
    4. $file_tmp=$_FILES['upload']['tmp_name'][$key];
    5. $file_new='gehtup/'.$time_var.'_'.$_FILES['upload']['name'][$key];
    6. move_uploaded_file($file_tmp,$file_new);
    7. }


    Source Code

    1. $arr = apc_fetch("upload_{$_GET['uid']}");
    2. //printf("<pre>%s</pre>", print_r($arr,true));
    3. print(round(($arr['current']*100)/$arr['total'],1)."% uploaded");



    PHP Source Code

    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    2. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="de">
    3. <head>
    4. <title>APC Upload</title>
    5. <script type="text/javascript">
    6. function ajax(uid) {
    7. var req;
    8. try {
    9. req = window.XMLHttpRequest?new XMLHttpRequest():
    10. new ActiveXObject("Microsoft.XMLHTTP");
    11. } catch (e) {
    12. //Kein AJAX Support
    13. }
    14. req.onreadystatechange = function() {
    15. if ((req.readyState == 4) && (req.status == 200)) {
    16. document.getElementById("status").innerHTML = req.responseText;
    17. }
    18. }
    19. req.open('GET', 'status.php?uid='+uid, true);
    20. req.send("");
    21. }
    22. </script>
    23. </head>
    24. <body>
    25. <iframe src="upload.php" name="hidden_upload" style="display:show"></iframe>
    26. <div id="status"></div>
    27. <form action="upload.php" name="upload" target="hidden_upload" method="post" enctype="multipart/form-data">
    28. <div>
    29. <input type="hidden" name="APC_UPLOAD_PROGRESS" value="<?php echo uniqid();?>"/>
    30. <input type="file" name="upload[]" multiple />
    31. <input type="submit" onclick="this.disabled=false; setInterval('ajax(\''+this.form.APC_UPLOAD_PROGRESS.value+'\')', 750); "/>
    32. </div>
    33. </form>
    34. </body>
    35. </html>
    Display All


    Das Problem ist nur die Files kommen auch an, aber ich bekomme einfach meine Prozente nicht angezeigt bzw. nur ganz am Ende 100% und das wars.
    Danach faengt erst das JS an die Requestst zu senden.

    Hoffe Ihr koennt mir da helfen.

    Mfg Patrick

    The post was edited 1 time, last by paddy14 ().