This commit is contained in:
Čarodej
2022-03-31 11:18:09 +02:00
parent ef9f654834
commit ff476251f5
4 changed files with 24 additions and 7 deletions

View File

@@ -40,6 +40,10 @@
## Installation
- [How to install VPS with Debian 10](https://medium.com/vuefilemanager/how-to-set-up-vuefilemanager-laravel-application-on-vps-with-debian-10-64676a3ff4d7)
- [How to Set Up AWS S3](https://medium.com/vuefilemanager/how-to-set-up-vuefilemanager-with-aws-s3-as-an-external-storage-a2c525aec698)
- [How to Set Up Digital Ocean Spaces](https://medium.com/vuefilemanager/how-to-set-up-vuefilemanager-with-digital-ocean-spaces-as-a-external-storage-6cccf590c23d)
### 1. Upload files on your server
Upload project files to the web root folder of your domain. It's mostly located in `html`, `www` or `public_html` folder name.

View File

@@ -88,7 +88,7 @@ class UploadFileAction
// Create new file
$item = UserFile::create([
'mimetype' => get_file_type_from_mimetype($fileMimetype),
'mimetype' => $request->input('extension'),
'type' => get_file_type($fileMimetype),
'parent_id' => ($this->getFileParentId)($request, $user->id),
'name' => $request->input('filename'),

View File

@@ -1,4 +1,5 @@
<?php
namespace Domain\Maintenance\Controllers;
use DB;
@@ -110,5 +111,14 @@ class UpgradeSystemController extends Controller
->whereIn('parent_id', $teamFolderIds)
->update(['user_id' => $teamFolder->user_id]);
});
// Upgrade dwg files
File::withTrashed()
->where('mimetype', 'vnd.dwg')
->cursor()
->each(fn($file) => $file->update([
'mimetype' => 'dwg',
'type' => 'file',
]));
}
}

View File

@@ -637,16 +637,19 @@ if (! function_exists('format_date')) {
if (! function_exists('get_file_type')) {
/**
* Get file type from mimetype
*
* @param $file_mimetype
* @return string
*/
function get_file_type($file_mimetype)
function get_file_type(string $fileMimetype): string
{
// Get mimetype from file
$mimetype = explode('/', $file_mimetype);
$mimetype = explode('/', $fileMimetype);
if (in_array($mimetype[0], ['image', 'video', 'audio'])) {
// Check image
if ($mimetype[0] === 'image' && in_array(strtolower($mimetype[1]), ['jpg', 'jpeg', 'bmp', 'png', 'gif', 'svg', 'svg+xml'])) {
return 'image';
}
// Check video or audio
if (in_array($mimetype[0], ['video', 'audio'])) {
return $mimetype[0];
}