Re: Need a form to specify "SaveFiles" directory

  •  08-16-2012, 11:17 AM

    Re: Need a form to specify "SaveFiles" directory

    Here's the code:
     

    <?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">
    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>
    <?php  
    //Gets the GUID of the file based on uploader name  
    $fileguid=@$_POST["myuploader"];  
    $pathname=$_POST["pathname"];  
    if($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();  
        }  

    //echo phpinfo();
    ?> 
    </body>
    </html>

View Complete Thread