简体   繁体   中英

Japanese Character filename turns unnamed-file on file upload php

I am using a wordpress plugin ( Drag and Drop Multiple File Upload-Contact Form 7 ) and I tried uploading japanese character filename ex. サンプル.pdf and when it is uploaded the filename changes to unnamedfile.pdf.

My PHP version is 7.3.11

I tried adding this code :

header('Content-Type: text/plain; charset=utf-8');

at the top of the plugin's php file. And it's not working.

I also tried adding this code:

mb_internal_encoding('UTF-8');    
mb_http_output('SJIS');    
mb_http_input('UTF-8');       
mb_regex_encoding('UTF-8');

but it's not working.

I have encountered the same problem. What I did is I commented a method for the plugin when creating the filename.

I found out the plugin was using functions from a file named dnd-upload-cf7.php. This method seems to be the cause of the problem.

$filename = wpcf7_antiscript_file_name( $filename );

Just try this. Hope it works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM