mime tpye stuff
This commit is contained in:
parent
78bfff6945
commit
f9154b632a
2 changed files with 18 additions and 3 deletions
|
@ -30,8 +30,19 @@
|
|||
}
|
||||
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
$fid = bin2hex(random_bytes(16));
|
||||
move_uploaded_file($_FILES['file']['tmp_name'], $_SERVER["DOCUMENT_ROOT"] . '/../docs/pic/' . $fid . '.png');
|
||||
$postie .= "\nhttps://" . $_SERVER['HTTP_HOST'] . '/pic/' . $fid . '.png';
|
||||
|
||||
$type = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
|
||||
|
||||
$type = strtolower($type);
|
||||
|
||||
$mime = mime_content_type('test' . $type);
|
||||
|
||||
$legal = ['png','gif','jpeg','jpg','mp4','webm','mp3','wav'];
|
||||
|
||||
if (in_array($type, $legal)) {
|
||||
move_uploaded_file($_FILES['file']['tmp_name'], $_SERVER["DOCUMENT_ROOT"] . '/../docs/pic/' . $fid . '.' . $type);
|
||||
$postie .= "\nhttps://" . $_SERVER['HTTP_HOST'] . '/pic/' . $fid . '.' . $type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue