Re: Need a form to specify "SaveFiles" directory

  •  08-17-2012, 11:34 AM

    Re: Need a form to specify "SaveFiles" directory

    Ken, you were right.  Silly error on my part.  Thanks for the great support on this product.
     
    I moved the file handling code into a seperate method away from the form and now I'm getting a new error "Fatal error: Call to a member function GetUploadedFile() on a non-object in D:\Hosting\3380894\html\private\mike\Test\uploadfiles.php on line 17".
     
    I'm sure I'm doing something stupid again, but I can't find it.  I've included listings of both methods below.  Thanks again.  I'll be purchasing as soon as I can get this working.
     
    upload.php
     
    <?php require_once "./phpuploader/include_phpuploader.php" ?>
    <?php session_start(); ?>
    <?php
    if (!is_dir)
     mkdir ("D:/Hosting/3380894/html/tmp", 0777);
    else
     chmod("D:/Hosting/3380894/html/tmp", 0777);
    ?>
    <html>
    <body>
    <form id="form1" method="POST" action="uploadfiles.php">
    Upload Directory<input size=75 type=text name='pathname'>
    <?php  
                    //Step 2: Create Uploader object.  
                    $uploader=new PhpUploader();  
                    //Step 3: Set a unique name to Uploader  
                    $uploader->TempDirectory="D:/Hosting/3380894/html/tmp";
        $uploader->MaxSizeKB=1024000; 
        $uploader->Name="myuploader";   
                    //Step 4: Render Uploader  
                    $uploader->Render();  
    ?> 
    </form>
    </body>
    </html>
     
    uploadfiles.php
     

    <?php
    //Step 1: Register Uploader component to your page  
    require_once "./phpuploader/include_phpuploader.php";
    session_start();
    ?>  
    <html>  
    <body>  
    <?php  
    //Gets the GUID of the file based on uploader name  
    $fileguid=$_POST["myuploader"];  
    $pathname=$_POST["pathname"];  
    if($fileguid)  
    {  
     echo $fileguid;
     
        //get the uploaded file based on GUID  
        $mvcfile=$uploader->GetUploadedFile($fileguid);  
        if($mvcfile)  
        {  
            //Gets the name of the file.  
            //echo($mvcfile->FileName."<br/>");  
            //Gets the temp file path.  
            //echo($mvcfile->FilePath."<br/>");  
            //Gets the size of the file.  
            //echo($mvcfile->FileSize."<br/>");   
     
            //echo($pathname."<br/>");   

            //Copys the uploaded file to a new location.  
    //        $mvcfile->CopyTo("/uploads");  
            //Moves the uploaded file to a new location.  
            $mvcfile->MoveTo("D:/Hosting/3380894/html".$pathname);  
            //Deletes this instance.  
    //        $mvcfile->Delete();  
        }  
    }  
    ?> 
    </body>  
    </html> 

     
     
     
     
     
     
     
     
     
     
     
     
     
     
View Complete Thread