Ankündigung

Einklappen
Keine Ankündigung bisher.

APC_UPLOAD Fortschrittsbalken unter php 5.6

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • APC_UPLOAD Fortschrittsbalken unter php 5.6

    Hallo, ich bin gerade dabei eine Seite von php 5.3 auf 5.6 umzustellen, und bin auf folgendes Problem gestoßen:

    Upload-Formular zum Übertragen von großen Dateimengen (bis ca. 350 MByte) soll ein Progressbalken dargestellt werden .

    Dies ging auch alles bisher wunderbar.

    Im Uploadform:

    <form enctype="multipart/form-data" action="" method="post" class="form" autocomplete="off" name="form1" id="form1" />


    <input type="text" name="APC_UPLOAD_PROGRESS" id="progress_key" value="<?php echo $up_id; ?>"/>

    <input type="hidden" name="laden" value="laden" />
    <input type="hidden" name="UPLOAD_IDENTIFIER" id="UPLOAD_IDENTIFIER" value="<?php echo $id; ?>" />
    Daten ausw&auml;hlen:<br />
    <input name="thefile" type="file">



    <input type="submit" value="Daten laden >>>" class="button" id="but1">

    <br /><br /><br />
    <iframe id="upload_frame" name="upload_frame" frameborder="0" border="0" src="" scrolling="no" scrollbar="no" > </iframe>
    <br />
    </form>
    verwendet wurde . und im php wurde folgendes aufgerufen:


    Code:
    if(isset($_REQUEST['progress_key'])) {
         
    $status = apc_fetch('upload_'.$_REQUEST['progress_key']);
       
      echo $status['current']/$status['total']*100;
     
        die();
    
    }
    dies wird alles in einer document.ready - function aufgerufen:

    Code:
    <script>
    $(document).ready(function() {
    
    
        setInterval(function()
            {
                
        $.get("<?php echo $url; ?>?progress_key=<?php echo $_REQUEST['up_id']; ?>&randval="+ Math.random(), {
            //get request to the current URL (upload_frame.php) which calls the code at the top of the page.  It checks the file's progress based on the file id "progress_key=" and returns the value with the function below:
        },
            function(data)    //return information back from jQuery's get request
                {
    
                    $('#progress_container').fadeIn(100);    //fade in progress bar    
                    $('#progress_bar').width(data +"%");    //set width of progress bar based on the $status value (set at the top of this page)
                    $('#progress_completed').html(parseInt(data) +"%");    //display the % completed within the progress bar
                }
            )},500);    //Interval is set at 500 milliseconds (the progress bar will refresh every .5 seconds)
    
    });
    
    
    </script>


    Nun wurde der Server von 5.3 auf 5.6 umgestellt und nun funktioniert diese Funktion apc_fetch nicht mehr, da nun statt apc - apcu installiert ist.


    Nun meine Frage, was kann ich ändern, damit ich wieder den $status zurückbekomme? Ich hoffe, es kennt sich jemand damit aus.
    Falls es noch Fragen gibt, kein Problem.....



    Vielen Dank und lieben Gruß
    Reinhardt

  • #2
    Dafür gibt es seit PHP5.4 eine native Lösung. http://php.net/manual/de/session.upload-progress.php

    Kommentar


    • #3
      danke, das schau ich mir mal an.

      Kommentar

      Lädt...
      X