How do I change the name of a file when uploading it?
How to make sure that using this function the documents are uploaded to the folder with the home ID?
And how to change the file name from this one (E0FIfjmuAbTV9Nhol2Q31lRNBbJZpL1ZHhZ3VK4R.pdf), to (house id - contract - date)
if ($request->hasFile('passport'))
{
foreach($request->file('passport') as $passport){
$str_passport = $passport->store('passport','public');
$homes->passport()->create(['document' => $str_passport]);
}
}
@yuralons then can you right-click on that storage folder and allow "everyone" to have access to it?
I'm not familiar with changing permission on Windows but since the real question here is how to name a file upload I think that's a different question.
My files seem to be loading correctly, but they are not defined as an extension, that is, it looks like this now (id - [] - -) and the link itself leads to the 404 page, for the location of the file download. I can add an extra field to the title table, right? so that I can fill in the file name myself and upload it to the site?