mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-04-09 03:08:00 +02:00
parse url for filename if no content-disposition
This commit is contained in:
parent
dd245f40de
commit
766de1570a
12
upload.php
12
upload.php
@ -34,11 +34,23 @@
|
||||
if(strpos($hd, "Content-Type") === 0){
|
||||
$nt = explode(": ", $hd);
|
||||
$mime = $nt[1];
|
||||
if(strpos($mime, ";") > 0){
|
||||
$ms = explode(";", $mime);
|
||||
$mime = $ms[0];
|
||||
}
|
||||
}else if(strpos($hd, "Content-Disposition") === 0){
|
||||
$nn = explode("filename=", $hd);
|
||||
$fname = str_replace("\"", "", $nn[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if($fname == "remote"){
|
||||
//parse url if no content-disposition is set
|
||||
preg_match('@^.*\/(.*\.[a-zA-Z0-9]{0,4})@i', $_GET["remote"], $matches);
|
||||
if(count($matches) > 0){
|
||||
$fname = $matches[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tmpf = fopen("php://temp", 'rb+');
|
||||
|
Loading…
x
Reference in New Issue
Block a user