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

Last post 09-15-2010, 9:06 AM by Eric. 2 replies.
Sort Posts: Previous Next
  •  09-15-2010, 5:01 AM 64022

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

     //Gets the file GUID list based on uploader name      
        $fileguidlist=@$_POST["myuploader"];
    Hello i am not getting value in myuploader field
    Filed under:
  •  09-15-2010, 5:20 AM 64023 in reply to 64022

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

    1. <?php   
    2. //Gets the GUID of the file based on uploader name   
    3. $fileguid=@$_POST["myuploader"];   
    4. if($fileguid)   
    5. {   
    6.     //get the uploaded file based on GUID   
    7.     $mvcfile=$uploader->GetUploadedFile($fileguid);   
    8.     if($mvcfile)   
    9.     {   
    10.         //Gets the name of the file.   
    11.         echo($mvcfile->FileName);   
    12.         //Gets the temp file path.   
    13.         echo($mvcfile->FilePath);   
    14.         //Gets the size of the file.   
    15.         echo($mvcfile->FileSize);    
    16.            
    17.         //Copys the uploaded file to a new location.   
    18.         $mvcfile->CopyTo("/uploads");   
    19.         //Moves the uploaded file to a new location.   
    20.         $mvcfile->MoveTo("/uploads");   
    21.         //Deletes this instance.   
    22.         $mvcfile->Delete();   
    23.     }   
    24. }  
    25.  this code is not working
    26. ?> 
  •  09-15-2010, 9:06 AM 64028 in reply to 64023

    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 as RSS news feed in XML