Special Chars in Filename like ü, ä, and space = " "

Last post 08-20-2013, 8:08 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  08-20-2013, 3:19 PM 77870

    Special Chars in Filename like ü, ä, and space = " "

    Hi,

     

    thank you for this wonderful uploader script (I have the full license), but I have some problems with special chars in filename, which are unfortunately common in Austria and Germany.

     

    If the filename e.g. is "testuploadÄÄÄÄÄtest.gif" phpuploader can't access the file, would be "testuploadA?A?A?A?test.gif" or something else.

    My solution just would be to run a little str_replace and make the filename internet-capable, but I dont know where to put this replacing script.

     

    Can you tell me in which file and which line I can change the "filename" variable, so it is used in the next steps of the script?

     

    Thanks in advance and best greets, David 

  •  08-20-2013, 8:08 PM 77873 in reply to 77870

    Re: Special Chars in Filename like ü, ä, and space = " "

    Hi DaveMan,

     

    I suggest you handle the upload file store location and the new file name by method "CopyTo". Like the example below, it will save the upload file with the original file name. in that line, you can change the file name to any value you need.

    $mvcfile->FileName is the original file name. 

     

    1. <?php require_once "phpuploader/include_phpuploader.php" ?>  
    2. <?php session_start(); ?>  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5.     <head>  
    6.         <title>  
    7.             example  
    8.         </title>  
    9.     </head>  
    10.     <body>  
    11.   
    12.         <form id="form1" method="POST">  
    13.             <?php                  
    14.                     $uploader=new PhpUploader();  
    15.                     $uploader->MaxSizeKB=10240;  
    16.                     $uploader->Name="myuploader";  
    17.                     $uploader->InsertText="Select multiple files (Max 10M)";  
    18.                     $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.txt,*.zip,*.rar";    
    19.                     $uploader->MultipleFilesUpload=true;  
    20.                     $uploader->Render();  
    21.   
    22.             ?>  
    23.   
    24.         </form>  
    25.   
    26.   
    27.         <?php  
    28. $fileguidlist=@$_POST["myuploader"];  
    29. if($fileguidlist)  
    30. {  
    31. $guidlist=explode("/",$fileguidlist);     
    32.     foreach($guidlist as $fileguid)      
    33.     {      
    34.           
    35.         //get the uploaded file based on GUID         
    36.         $mvcfile=$uploader->GetUploadedFile($fileguid);         
    37.         if($mvcfile)         
    38.         {         
    39.        //save the upload file with the original file name     
    40.         $mvcfile->CopyTo("savefolder/".$mvcfile->FileName);   
    41.         }      
    42.     }      
    43.   
    44. }  
    45. ?>  
    46.   
    47.         </div>  
    48.     </body>  
    49. </html>  
     

    Regards,

     

    Ken 

View as RSS news feed in XML