3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-03-29 20:04:21 +00:00

Added the 'required' attribute to the input file n the upload file form modal. Added a validation for the UserFilesController if the user doesn't select any file to upload [ch16471].

This commit is contained in:
Ivan Nieto Vivanco
2021-05-27 15:48:13 -05:00
parent 7d5a9180e6
commit 9f944ad497
2 changed files with 5 additions and 1 deletions

View File

@ -33,6 +33,10 @@ class UserFilesController extends Controller
$logActions = [];
$files = $request->file('file');
if (is_null($files)){
return redirect()->back()->with('error', trans('admin/users/message.upload.nofiles'));
}
foreach($files as $file) {
$extension = $file->getClientOriginalExtension();
$filename = 'user-' . $user->id . '-' . str_random(8);