Re: [Solved] Re: Getting error: Error: [8] Undefined index: UseUploadModule

  •  09-01-2013, 8:38 PM

    Re: [Solved] Re: Getting error: Error: [8] Undefined index: UseUploadModule

    Hi Ken,

    I thought I had this solved, but it turns out I'm still getting the same error. I believe that $fileguidlist is not getting set.
    Here is the code I'm attempting to run:

    1. <?php require_once "phpuploader/include_phpuploader.php" ?>  
    2. <?php session_start();   
    3. set_error_handler("customError");  
    4.   
    5. function customError($errno$errstr) {  
    6.     echo "<p><b>Error:</b> [$errno] $errstr</p>";  
    7.     //echo "Ending Script";  
    8.     //die();  
    9. }    
    10.   
    11.     $fileguidlist=@$_POST['myuploader'];  
    12.   
    13.     $firstname = $_POST['first-name'];  
    14.     $lastname = $_POST['last-name'];  
    15.     $companyname = $_POST['company-name'];  
    16.     $email = $_POST['email'];  
    17.     $phone = $_POST['phone'];  
    18.     $btn = $_POST['btn'];  
    19.     $message = $_POST['message'];  
    20.   
    21. ?>  
    22. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
    23. <html xmlns="http://www.w3.org/1999/xhtml">  
    24. <head>  
    25.     <title>  
    26.         Form - Start uploading manually  
    27.     </title>  
    28.     <link href="demo.css" rel="stylesheet" type="text/css" />  
    29.               
    30.     <script type="text/javascript">  
    31.     function doStart()  
    32.     {  
    33.         var uploadobj = document.getElementById('myuploader');  
    34.         if (uploadobj.getqueuecount() > 0)  
    35.         {  
    36.             uploadobj.startupload();  
    37.         }  
    38.   
    39.     }  
    40.     </script>  
    41.       
    42. </head>  
    43. <body>  
    44.   
    45.     <?php if (!isset($firstname) || $firstname == false) { ?>     
    46.   
    47.         <div class="demo">       
    48.             <h2>Start uploading manually</h2>  
    49.             <p>This sample demonstrates how to start uploading manually after file selection vs automatically.</p>  
    50.             <P>Allowed file types: <span style="color:red">jpg, gif, txt, png, zip</span></p>  
    51.               
    52.   
    53.             </form>  
    54.             <form id="ab-form" action="" class="awesome" method="post" >  
    55.                 <p>* Required field</p>  
    56.                 <fieldset>  
    57.                     <div class="input">                        
    58.                             <label for="first-name" class="inlined">First Name*</label>  
    59.                             <input class="input-text" id="first-name" name="first-name" type="text" required />  
    60.                     </div>  
    61.                     <div class="input">  
    62.                             <label for="last-name" class="inlined">Last Name*</label>  
    63.                             <input class="input-text" id="last-name" name="last-name" type="text" required />                                                
    64.                     </div>  
    65.                     <div class="input">  
    66.                             <label for="company-name" class="inlined">Company Name*</label>  
    67.                             <input class="input-text" id="company-name" name="company-name" type="text" required />  
    68.                     </div>  
    69.                     <div class="input">  
    70.                             <label for="email" class="inlined">E-mail Address*</label>  
    71.                             <input class="input-text" id="email" name="email" type="text" required />  
    72.                     </div>             
    73.                     <div class="input">  
    74.                             <label for="btn" class="inlined">BTN*</label>  
    75.                             <input class="input-text" id="btn" name="btn" type="text" required />  
    76.                     </div>   
    77.                     <div class="input">  
    78.                             <label for="phone" class="inlined">Phone Number*</label>  
    79.                             <input class="input-text" id="phone" name="phone" type="text" required />  
    80.                     </div>                                                       
    81.                 </fieldset>  
    82.                 <fieldset>  
    83.                     <div class="file-upload">  
    84.                         <?php                  
    85.                             $uploader=new PhpUploader();  
    86.                             $uploader->MaxSizeKB=10240;  
    87.                             $uploader->Name="myuploader";  
    88.                             $uploader->InsertText="Select multiple files (Max 10M)";  
    89.                             $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.txt,*.zip,*.rar";    
    90.                             $uploader->MultipleFilesUpload=true;  
    91.                             $uploader->ManualStartUpload=true;  
    92.                             $uploader->Render();  
    93.                         ?>  
    94.                         <div class="instructions">  
    95.                             <p>If you have multiple files, simply choose them one at a time using the Upload Documents button.</p>  
    96.                         </div>  
    97.                     </div>  
    98.                 </fieldset>  
    99.                 <fieldset>  
    100.                     <div class="text-area">  
    101.                             <label for="message" class="inlined">How can we help you?</label>  
    102.                             <textarea class="input-textarea" id="message" name="message" >   
    103.                        
    104.                   
    105.                     <div class="submit">  
    106.                         <!-- <input type="image" src="/wp-content/themes/telegration/images/btn-submit.png" alt="Submit" value="submit" name="submit" onclick="doStart();return false;"> -->   
    107.                         <button id="submitbutton" onclick="doStart();return false;">Start Uploading Files</button>  
    108.   
    109.                     </div>  
    110.                           
    111.           
    112.   
    113.     <!--?php } else {  
    114.         $uploader=new PhpUploader();  
    115.   
    116.             //$fileguidlist=@$_POST["myuploader"];  
    117.         echo "<p-->First Name: " . $firstname . "<p></p>";  
    118.         echo "<p>Last Name: " . $lastname . "</p>";  
    119.         echo "<p>Company Name: " . $companyname . "</p>";  
    120.         echo "<p>E-mail: " . $email . "</p>";  
    121.         echo "<p>Phone: " . $phone . "</p>";  
    122.         echo "<p>BTN: " . $btn . "</p>";  
    123.         echo "<p>Message: " . $message . "</p>";  
    124.   
    125.   
    126.         if($fileguidlist) {  
    127.             $guidlist=explode("/",$fileguidlist);  
    128.               
    129.             echo("<div style="font-family:Fixedsys;">");  
    130.             echo("Uploaded ");  
    131.             echo(count($guidlist));  
    132.             echo(" files:");  
    133.             echo("</div>");  
    134.             echo("<hr>");  
    135.               
    136.             foreach($guidlist as $fileguid)  
    137.             {  
    138.                 $mvcfile=$uploader->GetUploadedFile($fileguid);  
    139.                 if($mvcfile)  
    140.                 {  
    141.                     echo("<div>");  
    142.                     echo("FileName: ");  
    143.                     echo($mvcfile->FileName);  
    144.                     echo("<br>FileSize: ");  
    145.                     echo($mvcfile->FileSize." b");  
    146.                     echo("<br>FilePath: ");  
    147.                     echo($mvcfile->FilePath);  
    148.                     echo("</div>");  
    149.                       
    150.                     //Moves the uploaded file to a new location.  
    151.                     //$mvcfile->MoveTo("../../uploads/files");  
    152.                     //Copys the uploaded file to a new location.  
    153.                     $mvcfile->CopyTo("D:/website_data/www.telegration.com/wp-content/uploads/files");  
    154.                     //Deletes this instance.  
    155.                     $mvcfile->Delete();  
    156.                 }  
    157.             }  
    158.         }  
    159.     }         
    160.   
    161.     ?>  
    162.                       
    163.           
     Can you see what I'm doing wrong?

     

    Thanks!

     

    Jack 

View Complete Thread