how to implementing a php upload process indicator

Discussion in 'PHP' started by seeing, Sep 19, 2007.

  1. #1
    hello :)

    i have managed to get my php to work as in, an uploader user page

    1) uploadForm1.php ||| amount of files to be uploaded

    
    <html>
    <head>
    <title># of Files to Upload</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <form name="form1" method="post" action="uploadForm2.php">
      <p>Enter the amount of boxes you will need below. Max = 9.</p>
      <p>
        <input name="uploadNeed" type="text" id="uploadNeed" maxlength="1">
      </p>
      <p>
        <input type="submit" name="Submit" value="Next">
      </p>
    </form>
    </body>
    </html>
    
    PHP:
    2) uploadForm2.php ||| browse and upload files

    
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    
    <form name="form1" enctype="multipart/form-data" method="post" action="processFiles.php">
      <p>
      <?
      $uploadNeed = $_POST['uploadNeed'];
      for($x=0;$x<$uploadNeed;$x++){
      ?>
        <input name="uploadFile<? echo $x;?>" type="file" id="uploadFile<? echo $x;?>">
      </p>
      <?
      }
      ?>
      <p><input name="uploadNeed" type="hidden" value="<? echo $uploadNeed;?>">
        <input type="submit" name="Submit" value="Upload">
      </p>
    </form>
    </body>
    </html>
    
    PHP:
    3) processFiles.php ||| the uploader

    
    <?
    $uploadNeed = $_POST['uploadNeed'];
    for($x=0;$x<$uploadNeed;$x++){
    $file_name = $_FILES['uploadFile'. $x]['name'];
    $file_name = stripslashes($file_name);
    $file_name = str_replace("'","",$file_name);
    $path = 'uploads/';
    $copy = copy($_FILES['uploadFile'. $x]['tmp_name'],$path.$file_name);
    
     if($copy){
     echo"<font color=#009999 face=verdana size=10>$file_name | uploaded sucessfully!<br>";
     }else{
     echo "$file_name | could not be uploaded!<br></font>";
     }
    }
    ?>
    
    PHP:
    i don't know how to implement a process indicator though ... something simple such as "file is being uploaded, please wait"

    i am guessing that it would form part of an echo command line

    any ideas or any url tutorials?


    thanks



    sophia
     
    seeing, Sep 19, 2007 IP
  2. seeing

    seeing Guest

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RE: process indicator

    i have found a few sites that output the file upload process
    but they either use flash or javascript...

    http://pdoru.from.ro/

    http://swfupload.mammon.se/


    i only want a simple message to display after the "upload" input button is clicked

    i had been studying the php code and the "action" command
    on the input line directs the subsequent action (lol) of the
    button as in....

    
    <form name="form1" method="post" action="uploadForm2.php">
    
    PHP:
    this opens the page "uplaodform2.php"

    
    <form name="form1" enctype="multipart/form-data" method="post" action="processFiles.php">
    
    PHP:
    this then runs the processFile.php data

    i would like an intermittent page/code in between the uploadform2.php and the processFile.php to display "uploading in process, please wait....." and also be able to read/process the processfile.php data


    this may be simple, may be hard but i can't do it :(


    any help with this?


    thanks


    sophia
     
    seeing, Sep 19, 2007 IP