Is the file input named file or job_spec?
Jan 22, 2025
4
Level 1
My app is storing filenames in the database as /private/var/tmp/phpB5fgal etc..
Apologies if this has been discussed before but I can't find anything in the forums.
I have linked public/storage using php artisan storage:link and this is my method
public function store(StoreJobRequest $request) {
$fields = $request->validated();
if ($request->hasFile('file')) {
$fields['job_spec'] = $request->file('job_spec')->store('files/job-specs');
//$fields['job_spec'] = Storage::disk('public')->put('files/job-specs', $request->job_spec);
}
$request->user()->jobs()->create($fields);
return redirect()->route('jobs.index')->with('status', 'Job created successfully');
}
But when i check the database its storing the job_spec column with the private/var/tmp/random_string. I also can't see the uploaded file in my public/storage directory. I have tried different ways of storing the file but still get the same the result.
My local .env has FILESYSTEM_DISK=public
Can anyone help me? It's probably a really stupid error.
Please or to participate in this conversation.