Re: Manual Upload - So I can upload file and save fields

  •  06-25-2012, 6:13 AM

    Re: Manual Upload - So I can upload file and save fields

    Hi derekml,
     
    You can find all source code of the demo in the php uploader demo package.
     
    Demo package download url: http://www.cutesoft.net/downloads/folders/52443/download.aspx 
     
    I also attached the manual start upload example code below. 
    1. <?php require_once "phpuploader/include_phpuploader.php" ?>  
    2. <?php session_start(); ?>  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head>  
    6.     <title>  
    7.         Form - Start uploading manually  
    8.     </title>  
    9.               
    10.     <script type="text/javascript">  
    11.     function doStart()  
    12.     {  
    13.         var uploadobj = document.getElementById('myuploader');  
    14.         if (uploadobj.getqueuecount() > 0)  
    15.         {  
    16.             uploadobj.startupload();  
    17.         }  
    18.         else  
    19.         {  
    20.             alert("Please browse files for upload");  
    21.         }  
    22.     }  
    23.     </script>  
    24.       
    25. </head>  
    26. <body>  
    27.       
    28.             <form id="form1" method="POST">  
    29.                 <?php      
    30.                     $uploader=new PhpUploader();  
    31.                     $uploader->Name="myuploader";  
    32.                     $uploader->InsertText="Select multiple files (Max 1000M)";  
    33.                     $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.txt,*.zip,*.rar";    
    34.                     $uploader->MultipleFilesUpload=true;  
    35.                     $uploader->ManualStartUpload=true;  
    36.                     $uploader->Render();  
    37.                 ?>  
    38.                 <br /><br /><br />  
    39.                 <button id="submitbutton" onclick="doStart();return false;">Start Uploading Files</button>  
    40.   
    41.             </form>  
    42.               
    43.             <br/><br/><br/>  
    44. <?php  
    45. $fileguidlist=@$_POST["myuploader"];  
    46. $item = @$_POST["text1"];  
    47. if($fileguidlist)  
    48. {  
    49.     $guidlist=explode("/",$fileguidlist);  
    50.       
    51.     echo("<div style='font-family:Fixedsys;'>");  
    52.     echo("Uploaded ");  
    53.     echo(count($guidlist));  
    54.     echo(" files:");  
    55.     echo("</div>");  
    56.     echo("<hr/>");  
    57.       
    58.     foreach($guidlist as $fileguid)  
    59.     {  
    60.         $mvcfile=$uploader->GetUploadedFile($fileguid);  
    61.         if($mvcfile)  
    62.         {  
    63.             echo("<div style='font-family:Fixedsys;border-bottom:dashed 1px gray;padding:6px;'>");  
    64.             echo("FileName: ");  
    65.             echo($item.$mvcfile->FileName);  
    66.             echo("<br/>FileSize: ");  
    67.             echo($mvcfile->FileSize." b");  
    68.     //      echo("<br/>FilePath: ");  
    69.     //      echo($mvcfile->FilePath);  
    70.             echo("</div>");  
    71.               
    72.             //Moves the uploaded file to a new location.  
    73.             //$mvcfile->MoveTo("/uploads");  
    74.             //Copys the uploaded file to a new location.  
    75.             //$mvcfile->CopyTo("/uploads");  
    76.             //Deletes this instance.  
    77.             //$mvcfile->Delete();  
    78.         }  
    79.     }  
    80. }  
    81. ?>  
    82.                   
    83.     </div>  
    84. </body>  
    85. </html>  
    Regards,
     
    Ken 
     
View Complete Thread