esbenp / fineuploader-server

MIT License
7 stars 11 forks source link

$file->getType() being called after temp dir has been deleted #10

Open jaredcassidy opened 7 years ago

jaredcassidy commented 7 years ago

Laravel 5.4

I am getting the following error when I try upload with fineUploader:

ErrorException exif_imagetype(/home/vagrant/wed/storage/uploader/temp/a772c5d4-06a7-4b8f-aecf-7dd78c8c196e/59aee10d2c4f4.jpg): failed to open stream: No such file or directory

It seems that in prepareUploadSuccessfulResponse $file->getType() is called which is looking for the file in the temp dir, after the directory has been deleted in Uploader.php line 96

As a quick fix I have commented out the file_type line but would love to find a proper solution

private function prepareUploadSuccessfulResponse(array $response, RootFile $file)
{
    return array_merge($response, [
        'type' => 'upload',
        'success' => true,
        //'file_type' => $file->getType(),
        'original_name' => $file->getOriginalName(),
        'upload_path' => $this->clearFileExtension($file->getName())
    ]);
}
sdfarshid commented 2 years ago

U can add
$file->setType( $file->getType()); in the store method of custom LocalStorage class