Re: not geting value in $fileguidlist=@$_POST["myuploader"];

  •  09-15-2010, 9:06 AM

    Re: not geting value in $fileguidlist=@$_POST["myuploader"];

    Dear pandurang,
     
    Please check:
    1. Put php uploader within tag <form>
    2. $uploader->Name="myuploader";
        and
        $fileguid=@$_POST["myuploader"];   
        These two lines should have same ID.
     
     
    Please refer to the following example code:
    <?php require_once "phpuploader/include_phpuploader.php" ?>
    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     <title>
      Form - Keeping state after submitting
     </title>
     <link href="demo.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
     <div class="demo">  
    <form id="form1" method="POST">
    <?php
       $uploader=new PhpUploader();   
       $uploader->MultipleFilesUpload=false;
       $uploader->InsertText="Upload File (Max 10M)";
       $uploader->Name="myuploader";
       $uploader->MaxSizeKB=1024000; 
       $uploader->AllowedFileExtensions="jpeg,jpg,gif,png,zip";   
       //Where'd the files go?
       //$uploader->SaveDirectory="/myfolder";   
       $uploader->Render();
      ?> 
    <br/>
    <br/>
    <br/>
    <?php  
    //Gets the GUID of the file based on uploader name
    $fileguid=@$_POST["myuploader"];  
    if($fileguid)  
    {  
        //get the uploaded file based on GUID  
        $mvcfile=$uploader->GetUploadedFile($fileguid);  
        if($mvcfile)  
        {  
            //Gets the name of the file.  
            echo($mvcfile->FileName);  
            //Gets the temp file path.  
            echo($mvcfile->FilePath);  
            //Gets the size of the file.  
            echo($mvcfile->FileSize);
            //Copys the uploaded file to a new location.  
            $mvcfile->CopyTo("/uploads");  
            //Moves the uploaded file to a new location.  
            $mvcfile->MoveTo("/uploads");  
            //Deletes this instance.  
            $mvcfile->Delete();  
        }  
    }  
    ?>
    </form>
    </div>
    </body>
    Thank you for asking
View Complete Thread