Perhaps upload them to an image folder underneath public, you could try that. Then use the asset helper to display them. In such a case as a symbolic link is not needed.
Just a suggestion.
Hi everyone! I am very new to Laravel everything went great until i tried to upload two files using form
FileControllerphp
public function store(Request $request)
{
$file = $request->all();
$file['uuid'] = (string)Uuid::generate();
$file['uuid2'] = (string)Uuid::generate();
if ($request->hasFile('filename')) {
$file['filename'] = $request->filename->getClientOriginalName();
$request->filename->storeAs('files', $file['filename']);
}
if ($request->hasFile('filename2')) {
$file['filename2'] = $request->filename2->getClientOriginalName();
$request->filename2->storeAs('files', $file['filename2']);
}
File::create($file);
return PostController::createPost($request);
}
PostControllerphp
public static function createPost(Request $request)
{
$post = new Post();
$post->title = $request->title;
$post->body = $request->body;
$post->save();
return back()->with('post_created','Post created');
}
Here you can see record in my table:
MariaDB [app]> select * from files;
+----+--------------------------------------+--------------------------------------+-----------------------------+--------------------------------------------+----------------------------------------------------------------+---------------------+---------------------+
| id | uuid | uuid2 | title | filename | filename2 | created_at | updated_at |
+----+--------------------------------------+--------------------------------------+-----------------------------+--------------------------------------------+----------------------------------------------------------------+---------------------+---------------------+
| 1 | ac68722097223a3fb7c7 | ac68738b3d1e5cc1fc | Testa title | Read Me First.txt | 10AppsManagerxls | 2020-11-29 11:04:38 | 2020-11-29 11:04:38 |
When i submit a form, it creates a post as i expected, but the files are not uploaded on my server (folder storage, files) I checked documentation, folder rights, but still no luck
Any help would be highly appreciated
I can not post something when i use a full-stop, i got everytime this message "You may not include links the first day you sign up"
Please or to participate in this conversation.