Unable to get file name of uploaded file

  •  06-22-2011, 5:07 PM

    Unable to get file name of uploaded file

    I am trying to rename a file after it has been uploaded but I am unable to get the file name.  I can get the GUID for the file but not the file name.  Any ideas why $uploader is not returning a phpuploadfile object?
     
    Here is how I instantiate the uploader:
                      <form id="form1" method="POST">
                            <?php
                               $uploader=new PhpUploader();
                               $uploader->Name="current_uploader";
                               $uploader->MultipleFilesUpload=true;
                               $uploader->InsertText="Select file(s)";
                               //$uploader->MaxSizeKB=1024000;
                               $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.bmp,*.txt,*.zip";
                               $uploader->SaveDirectory="files/" . $_SESSION['orgid'];
                               $uploader->FlashUploadMode="Partial";
                               $uploader->Render();
                            ?>
                            </form>
    Here is where I try to rename the file:
       $fileguid=$_POST["current_uploader"];
       if($fileguid)
       {
          echo $fileguid;
          $uploadedfile=$uploader->GetUploadedFile($fileguid);
          echo "myfile=" . $uploadedfile->FileName;
          if($uploadedfile)
          {
             //Rename the uploaded file
             echo "Renaming file";
             $uploadedfile->MoveTo("./".$_SESSION['curTkt']."-".$uploadedfile->FileName);
          }
       }
    The echoes are for debugging.  It echoes the fileguid but then $uploadedfile->FileName is empty.  It never gets to the part that echoes "Renaming file."
     
View Complete Thread