This code works properly to make the ZIP file with the wanted files, except the filenames in the archive, which are not in English (in this case they are Hebrew), have weird characters instead of the proper hebrew letters.
<?php
$filesfordown = $_POST['GEMin'];
if(empty($filesfordown))
{
echo "No files were seleceted for download.";
}
else
{
$zip_name = "RMW." . time() . ".zip";
$zip = new ZipArchive;
$zip->open($zip_name, ZipArchive::CREATE);
foreach ($filesfordown as $filefordown) {
$zip->addFile($filefordown);
}
$zip->close(); }
header('Content-Type: application/zip');
header("Content-disposition: attachment; filename='$zip_name'");
header('Content-Length: ' . filesize($zip_name));
readfile($zip_name);
ob_flush;
?>
I did some searching around, it seems that iconv, setlocalte, or mb_convert_encoding might help, but whatever I tried didn't work.
Any ideas?
P.S. As a side question, is there a way to not keep directory structure in the zip?
ETA:
An example of the $_post
may be www.domain.com/path/????_01.mp3
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…