Copy File Guid or Combination Of Both To Server Folder

Last post 02-14-2012, 7:12 AM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  02-10-2012, 8:12 AM 72980

    Copy File Guid or Combination Of Both To Server Folder

    I wonder whether someone may be able to help me please.
     
    Part of my script, like most I suspect, contains the line which copies the image to a server folder via:
     
    $mvcfile->CopyTo("saveimagefiles");
     
    This correctly saves the file using the filename as the identifier for the file. Could someone perhaps tell me please is there a way to do the following:
     
    Copy the file using the FileGuid as the file identifier, and
    Combine the two pieces of information i.e. the filename and File Guid
     
    Many thanks and kind regards
     
    Chris
     
     
    Filed under:
  •  02-10-2012, 3:38 PM 72985 in reply to 72980

    Re: Copy File Guid or Combination Of Both To Server Folder

    Hi IRHM73,
     
    We have provide the method to allow you get the file guid and the file name, I think you need to  write your own logic to save the info into your server.
     
    Regards,
     
    Ken 
  •  02-13-2012, 6:17 AM 73006 in reply to 72985

    Re: Copy File Guid or Combination Of Both To Server Folder

    Hi Ken, many thanks for this.
     
    It's not the moving of the 'File Guid' name to my database that's the problem, I'm already doing this, but it's the name of the physical image file that I'm saving my folder on my server. It currently saves the file using the filename as a way of identifying it, but I'm trying to save this using the 'File Guid' name.
     
    I've been through all the documentaion and the forum posts to try and find a way of changing this without any luck.
     
    Are you able to help me with this please?
     
    Many thanks
     
     
  •  02-14-2012, 7:12 AM 73020 in reply to 73006

    Re: Copy File Guid or Combination Of Both To Server Folder

    Hi IRHM73,
     
    The example below shows you how to save the upload file by method "CopyTo". This method allow you handle the file location and the file name.
     
    <?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 - Start uploading manually
    </title>
    </head>
    <body>
     
    <form id="form1" method="POST">
    <?php
    $uploader=new PhpUploader();
    $uploader->MaxSizeKB=10240;
    $uploader->Name="myuploader";
    $uploader->InsertText="Select multiple files (Max 10M)";
    $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.txt,*.zip,*.rar";
    $uploader->MultipleFilesUpload=true;
    $uploader->Render();
       ?>
    </form>
    <?php
    $fileguidlist=@$_POST["myuploader"];
    if($fileguidlist)
    {
    $guidlist=split("/",$fileguidlist);     
        foreach($guidlist as $fileguid)    
        {    
            
            //get the uploaded file based on GUID       
            $mvcfile=$uploader->GetUploadedFile($fileguid);       
            if($mvcfile)       
            {       
            $mvcfile->MoveTo("D:/2005/phpuploader/test/".$mvcfile->FileName); 
            }    
        }    
    }
    ?>
    </div>
    </body>
    </html>
     
    Regards,
     
    Ken 
View as RSS news feed in XML