I wanted to change the language/word of the highlighted as shoen in the picture below
Reference picture
CODES
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="{{ URL::to('importExcel/1') }}" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>Please upload file</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
Related
i have problem on my code, i cant pass uploaded file into the request this is my form
<form method="POST" action="{{ route('user.update', ['user' => Auth::user()]) }}" autocomplete="off" enctype="multipart/form-data">
#method('PUT')
#csrf
<div class="form-group focused">
<label for="avatar" class="form-control-label">Profile Pic
<span class="small text-danger">*</span></label>
<input type="file" class="form-control-file" name="avatar" id="avatar" accept=".jpeg,.jpg,.png">
</div></form>
i tried to dump my request variable in my update method in user controller but it return null
dd($request->file('avatar'));
please help me, ill be very helpful
btw sorry for my bad english
View File:
<form method="post" action="{{ route('user.update', ['user' => Auth::user()]) }}" enctype="multipart/form-data">
#method('PATCH')
#csrf
<div class="form-group focused">
<label for="avatar" class="form-control-label">
Profile Pic
<span class="small text-danger">*</span>
</label>
<input type="file" name="avatar" id="avatar">
</div>
</form>
I tried to update a post using edit route but when I send the form and use the update function give me an error
my code is
<form action="/posts{{$posts->id}}" method="POST">
#method('PUT')
#csrf
<label for="">title</label>
<input type="text" name="title" class="form-control" >
<label for="">body</label>
<textarea type="text" name="body" class="form-control">{{$post->body}}</textarea>
<input type="submit" class="btn btn-primary" value="edit">
You have to use like this
<form action="{{url('')}}/posts/{{$post->id}}" method="POST">
#csrf
<label for="">title</label>
<input type="text" name="title" class="form-control" >
<label for="">body</label>
<textarea type="text" name="body" class="form-control">{{$post->body}}</textarea>
<input type="submit" class="btn btn-primary" value="edit">
And in your route use like this
Route::post('/posts/{id}', ...)
You are missing a / in your action
action="/posts/{{ $posts->id }}"
You could do the following :
<form action="{{ route('route.name', $post->id) }}" method="POST">
#csrf
<label for="">title</label>
<input type="text" name="title" class="form-control" >
<label for="">body</label>
<textarea type="text" name="body" class="form-control">{{$post->body}}</textarea>
<input type="submit" class="btn btn-primary" value="edit">
And for the route :
Route::post('/posts/{id}', 'Controller#function')->name('route.name');
I put a hidden method that I found on laravel documents and worked fine
<form action="/posts/{{$post->id}}" method="POST">
#csrf
<label for="">title</label>
<input type="text" name="title" class="form-control" >
<label for="">body</label>
<textarea type="text" name="body" class="form-control">{{$post->body}}.
</textarea>
<input type="submit" class="btn btn-primary" value="edit">
<input type="hidden" name="_method" value="PUT">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>
I'm using Laravel 5.6, and the following is my view (leads/show.blade.php):
<form method="post" id="student_form">
{{csrf_field()}}
<span id="form_output"></span>
<div class="form-group">
<label>Choose Group for Your Lead</label>
<select name="group_id" id="group_id" class="form-control">
#foreach($groups as $group)
<option value="{{$group->id}}"> {{$group->name}}</option>
#endforeach
</select>
<input type="hidden" name="customer_id" id="customer_id" value="{{$lead->id}}">
</div>
<div class="modal-footer">
<input type="hidden" name="student_id" id="student_id" value="" />
<input type="hidden" name="button_action" id="button_action" value="insert" />
<input type="submit" name="submit" id="action" value="Add" class="btn btn-info" />
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
and the route is :
Route::post('leads/savegroup', 'LeadsController#savegroup')->name('leads.savegroup');
Please help me to find the error in this route.
Add <form method="post" id="student_form" action="{{ url('/leads/savegroup') }}">
to your code.As you are posting data to empty route .You need to define some action.
Currently I have Bootstrap Grids in one page as shown in the picture below.
My Bootstrap Grids
And I want grid as shown in picture below with red indicator
Wanted my Bootstrap Grid Like This
Codes
<div class="row">
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
</div>
Add some offset to your last col, like :
<div class="col-md-6 col-md-offset-3">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
I'm working on a laravel project where I need file upload. I have successfully managed to get file upload for the create function working, but for the edit() and update() functions, it won't. The main problem is that the form won't submit. here is the import pits of my form:
<form action="{{route('ads.update', $ad->id)}}" class="form-horizontal" method="post" enctype="multipart/form-data">
<input type="hidden" name="_method" value="PATCH">
<input type="hidden" name="_token" value="{{ csrf_token() }}"><div class="form-group">
<label for="imageUpload" class="control-label col-md-4">#lang('image upload')</label>
<div class="col-md-6">
<input type="file" name="images[]" class="form-control" multiple="multiple">
</div>
</div><input type="submit" value="أضف التعديل" class="btn btn-success btn-block btn-default">
</form>
Whenever I delete this section of code, the form submits and the update() works flawlessly
<div class="form-group">
<label for="imageUpload" class="control-label col-md-4">#lang('image upload')</label>
<div class="col-md-6">
<input type="file" name="images[]" class="form-control" multiple="multiple">
</div>
Things I've tried:
Changing the enctype to put
Changing the method from PATCH to PUT
Thanks in advance for your help