I have been researching for a while but all the solutions that I had find did not work
so It is super simple, I have this in view
<form method="POST" action="" enctype="multipart/form-data">
<input id="photoTarget" name="photoTarget" src="http://www.vetprofessionals.com/catprofessional/images/home-cat.jpg" type="image" style="width:400; height:300">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="submit" value="Upload" />
</form>
I have also a script that takes a photo with your webcam and sets the attribute src of the input (type=image):
photo.setAttribute('src',picTemp.toDataURL('image/png'));
This works well, the input does get the image and u can see it load in the element, nothing fancy, so once the input got the source of the image, you click upload to send the request to laravel, in my controller's code I have this:
public function setPhoto(){
$file = Request::file('photoTarget');
var_dump($file);
}
I mean it can be more easy, but I always get null in the var_dump
Nothing seems to work
full controller code:
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Request;
use App\Http\Controllers\Controller;
class PatientController extends Controller
{
public function setPhoto(){
$file = Request::file('photoTarget');
var_dump($file);
}
public function getFicha(){
return view('patient/ficha_medica');
}
}
Thanks in advance
btw, when I use the
<input type="file" name="fileToUpload" id="fileToUpload">
and manually choose a file, it works, but the idea is to take a photo with the webcam
type="file"
in your first snippet. – user2094178