Announcement

  •  » Extensions
  •  » [bug]File Uploader--double-byte filename & filesize & database

#1 2015-02-26 11:23:25

xuj1981
Member
Shanghai.CN
2015-02-06
3

[bug]File Uploader--double-byte filename & filesize & database

Hello/Hi/Greetings,

When I upload a file with double-byte file name,I find that programe should replace the name with "_".
Just like "______________.pdf",it's hard to distinguish。

So I modify some code,Let the file name looks like "20150211113109-kis9efro.pdf".

Add the following code before line39:
-------------------------------------------------------------------------------------
function ramdonname(){
$string = '1234567890abcdefghijklmnopgrstuvwxyz';
$rand = '';
for ($x=0;$x<8;$x++)
    $rand .= substr($string,mt_rand(0,strlen($string)-1),1);
return date("YmdHis").'-'.$rand;
}
----------------------------------------------------------------------------------
And replace
   $file_uploader_file_name = preg_replace('/[^a-zA-Z0-9s.]/', '_', $file_uploader_file['name']);
with
   $file_uploader_file_name = ramdonname().'.'.pathinfo($file_uploader_file['name'],PATHINFO_EXTENSION);


==========================================
------------------------------------------------------------------------------------
2nd problem is the filesize error.
It is not MB but KB~
I think it could replace
line207
'filesize' => $file_uploader_file['size'],
with
'filesize' => $file_uploader_file['size']*0.001,
==========================================
------------------------------------------------------------------------------------
The 3rd question is the database integrity.
When I use the plugin "RV DB Integrity",there are something error looks like the picture~
Can this be fixed?


Thanks~

Piwigo version: 2.7.4
PHP version: 5.4.36-0+deb7u3
MySQL version: Ver 14.14 Distrib 5.5.41
Piwigo URL: http://

Last edited by xuj1981 (2015-02-27 07:15:06)

Offline

 
  •  » Extensions
  •  » [bug]File Uploader--double-byte filename & filesize & database

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2021 · Contact