1

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?

1 Answer 1

2

You have to change like this

$identifica=$req->file('photo_id');

to

$identifica=$req->photo_id;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.