Replaced Moment with Carbon #84
1 changed files with 7 additions and 11 deletions
|
@ -10,9 +10,7 @@ class FileUploadService
|
|||
|
||||
public static function handleFile($request, $type = null)
|
||||
{
|
||||
//$upload = $request->getUploadedFiles(); //grab uploaded files
|
||||
//$options = $request->getParsedBody();
|
||||
//$file = $upload['upload_files'][0];
|
||||
//front end sends one by one for progress tracking, so grab first
|
||||
$file = $request->file('upload_files');
|
||||
$type = $file[0]->extension();
|
||||
|
@ -38,24 +36,22 @@ class FileUploadService
|
|||
}
|
||||
|
||||
break;
|
||||
case 'video/mp4':
|
||||
case 'mkv':
|
||||
case 'mp4':
|
||||
$filesPath = '/assets/video/blog/' . $path . '/';
|
||||
break;
|
||||
case 'audio/mpeg':
|
||||
case 'ogg':
|
||||
case 'mp3':
|
||||
$filesPath = '/assets/sound/blog/' . $path . '/';
|
||||
break;
|
||||
case 'application/pdf':
|
||||
case 'text/plain':
|
||||
case 'text/rtf':
|
||||
case 'pdf':
|
||||
case 'txt':
|
||||
case 'rtf':
|
||||
$filesPath = '/assets/docs/blog/' . $path . '/';
|
||||
break;
|
||||
}
|
||||
|
||||
//FileUploader::uploadFile('../public' . $filesPath, $file);
|
||||
$response = [];
|
||||
try {
|
||||
// if does not exist, so lets create it.
|
||||
//var_dump($filesPath);
|
||||
if (!is_dir($public_path . $filesPath)) {
|
||||
mkdir($public_path . $filesPath, 0755, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue