I have the follow data in my view file:
<form id='foto' action='photo' method="POST" enctype="multipart/form-data" >
@csrf
<img src="/images/blank.png" width=60px class="img-circle img-offline img-responsive img-profile" onclick="fileInput.click();"/>
<div style="height:0px;overflow:hidden"> <input type="file" accept=".jpg" id="fileInput" name="fileInput" onchange="this.form.submit()"/></div>
<input type='hidden' name='photo_id' id='photo_id' value='1234' >
</form>
In my controller I have:
function photo(Request $req)
{
$directory_name="public/".Auth::user()->id;
$identifica=$req->file('photo_id');
echo $identifica;
$req->file('fileInput')->storeAs($directory_name,$identifica.".jpg");
}
The upload image is stored as .jpg, because the $req->file('photo_id') or =$req->get('photo_id') is empty but must have a value=1234
How I do to get the value that comes from input photo_id?