How insert product multiple image by laravel? [closed] - mysql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
here is my html code form code.
<div class="form-group">
<label >Product Image</label>
<input type="file" class="form-control btn btn-primary" name="image[]" multiple="multiple">
</div>

you can use like this in your laravel controller file
in controller
$productSubImages = $request->file('sub_image');
foreach($productSubImages as $productSubImage){
$subImageName =$productSubImage->getClientOriginalName();
$subImageDirectory = 'product-sub-images/';
$productSubImage->move($subImageDirectory,$subImageName);
$subImageUrl =$subImageDirectory.$subImageName;
$subImage = new SubImage();
$subImage->product_id = $productId;
$subImage->sub_image = $subImageUrl;
$subImage->save();
}

Related

how can I prevent a user to type 0 as the first character in a text input using vanilla javascript? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have this html block:
<div class="form-group flex-auto" >
<input maxlength="2" class="form-control format__itemForm" type="text" ng-model="$ctrl.codigoPaisTelefono" prevent-keys="{{ $ctrl.caracteresExcluidos }}"
required oninput="this.value== 0? this.value == '' :void(0)"
>
</div>
I need to prevent users to type 0 as the first character, I tried oninput method above, but didn't work.
Any clue?
Something like this maybe?
function validate(element){
var val = element.value;
if(val.charAt(0)=='0'){
element.value=val.substring(1, val.length);
}
}
<input oninput="validate(this)">

Put button in div class="g-recaptcha" [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Is it possible to put some buttons on the right from g-recaptcha? for example like this:
I've just added to your code;
<div class="g-recaptcha" data-sitekey="6LcnqWUUAAAAAEc8mxt6aE1GIvasVmPqfy-cgYFK"</div>
<button class="added">Oooh look, a button!</button>
<button name="add" type="submit" id="napBUT" name="btn" class="btn btn-danger btn form-control">send</button>
Apply width:304px;float:leftto .g-recaptcha and width:calc(100% - 304px);margin-top:0; to .added

HTML button don't submit [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have this HTML code in a JSP page, but when I click it does not do anything
<button class="btn btn-grey" type="submit">Save device</button>
Hello Amadeu Cabanilles,
You have to put your button into form.
<form class="form-horizontal" method="post" modelAttribute="modelName" action="/submitSomeWhere">
<button type="submit" class="btn-lg btn-primary pull- right">Update</button>
</form>
Do you have proper form tags in your html , correct form post should be :
<form id="createMarkerForm"
method="post"
accept-charset="utf-8"
action="servletUrl">

What function does a submit button call? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to create my custom submit button. So I need to know what javascript function does the input type submit button call? I don't want a css customized submit button if possible.
In Case your HTML Looks like this:
<form id="myform" name="myform" action="destination.html">
<input id="sub_Button" type="button" value="clickme" onclick="mySubmitFunction();" />
</form>
Do you mean JavaScript?
document.myform.submit();
Or JQuery?
$("#myform").submit();

Why is onblur="trim()" used in input element? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
<input type="text" name="firstName" id="firstName" onblur="trim(document.TheForm.firstName)" value="" />
In the above element the why is attribute onblur="trim(document.TheForm.firstName)" used.
To remove trailing whitespace when you leave the field.
When a user leaves the input field firstName, the entered value is trimmed.