mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 15:47:17 +01:00
Dont upload rejected files
This commit is contained in:
@@ -63,7 +63,12 @@ class AttachmentApiController extends ApiController {
|
|||||||
|
|
||||||
$file = array_pop($files);
|
$file = array_pop($files);
|
||||||
|
|
||||||
|
if (!empty($file) && array_key_exists('error', $file) && $file['error'] !== UPLOAD_ERR_OK) {
|
||||||
|
return new JSONResponse([],Http::STATUS_BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
$fileId = $this->fileService->upload($file['name'], file_get_contents($file['tmp_name']));
|
$fileId = $this->fileService->upload($file['name'], file_get_contents($file['tmp_name']));
|
||||||
|
|
||||||
return new JSONResponse([
|
return new JSONResponse([
|
||||||
'file_id' => $fileId,
|
'file_id' => $fileId,
|
||||||
'preview_url' => $this->fileService->getPreviewUrl($fileId, 512),
|
'preview_url' => $this->fileService->getPreviewUrl($fileId, 512),
|
||||||
|
|||||||
Reference in New Issue
Block a user