Ad
Error: Call To A Member Function StoreAs() On String
public function cadastraAutomovelHomeAdd(Request $request)
{
$file = $request->arquivo;
$upload = $request->arquivo->storeAs('products', 'novonomeaffffff.jpg');
exit();
}
Form
<form method='post' action='/cadastrar' enctype="multipart/form-data">
{{ csrf_field() }}
<div>
<h5>Placa do Veículo:</h5>
</div>
<input type="file" class="form-control" name='arquivo' required placeholder="IMAGEM DO VEÍCULO">
<input type='submit'/>
</form>
Route
Route::post('/cadastrar','[email protected]');
I submit the form, and I get the following error.
Call to a member function storeAs() on string
Ad
Answer
You need to wrap it as a file to access the file methods, something like:
$upload = $request->file('arquivo')->storeAs('products', 'novonomeaffffff.jpg');
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad