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
+4
View File
@@ -40,6 +40,10 @@
## Installation ## 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 ### 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. Upload project files to the web root folder of your domain. It's mostly located in `html`, `www` or `public_html` folder name.
@@ -88,7 +88,7 @@ class UploadFileAction
// Create new file // Create new file
$item = UserFile::create([ $item = UserFile::create([
'mimetype' => get_file_type_from_mimetype($fileMimetype), 'mimetype' => $request->input('extension'),
'type' => get_file_type($fileMimetype), 'type' => get_file_type($fileMimetype),
'parent_id' => ($this->getFileParentId)($request, $user->id), 'parent_id' => ($this->getFileParentId)($request, $user->id),
'name' => $request->input('filename'), 'name' => $request->input('filename'),
@@ -1,4 +1,5 @@
<?php <?php
namespace Domain\Maintenance\Controllers; namespace Domain\Maintenance\Controllers;
use DB; use DB;
@@ -110,5 +111,14 @@ class UpgradeSystemController extends Controller
->whereIn('parent_id', $teamFolderIds) ->whereIn('parent_id', $teamFolderIds)
->update(['user_id' => $teamFolder->user_id]); ->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',
]));
} }
} }
+9 -6
View File
@@ -637,16 +637,19 @@ if (! function_exists('format_date')) {
if (! function_exists('get_file_type')) { if (! function_exists('get_file_type')) {
/** /**
* Get file type from mimetype * 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 // 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]; return $mimetype[0];
} }