Replace spaces in filenames, and sanatise all other extended utf8

This commit is contained in:
2025-09-10 21:24:42 +02:00
parent 9b4d64c2b1
commit 32f93f76ee

View File

@@ -361,7 +361,11 @@ it with the HPR Volunteer at admin@hackerpublicradio.org
foreach($_FILES["media_files"]["tmp_name"] as $key => $val) { foreach($_FILES["media_files"]["tmp_name"] as $key => $val) {
if ( $_FILES["media_files"]["error"][ "$key"] == 0 ) { if ( $_FILES["media_files"]["error"][ "$key"] == 0 ) {
$from = $_FILES["media_files"]["tmp_name"][ "$key"]; $from = $_FILES["media_files"]["tmp_name"][ "$key"];
$to = "${dir_structure}/${db_key}_" . rawurlencode( $_FILES["media_files"]["name"][ "$key"] ); $to = $_FILES["media_files"]["name"][ "$key"];
$to = rawurlencode( "${to}" );
$to = str_replace("%20","_",$to);
$to = str_replace("%","~",$to);
$to = "${dir_structure}/${db_key}_${to}";
$moveResult = move_uploaded_file($from, $to); $moveResult = move_uploaded_file($from, $to);
if ($moveResult != true) { if ($moveResult != true) {
echo "ERROR: File not moved correctly >$from< >$to<"; echo "ERROR: File not moved correctly >$from< >$to<";