problem with uploading image code - laravel
I hope you are doing well. I am new with laravel. I have a problem with a code for adding a product.
The problem is exactly in product_image. I can't have the image and I keep receiving the message "Product added Successfully! without image"
public function save_product(Request $request)
{
$data=array();
$data['product_name']=$request->product_name;
$data['category_id']=$request->category_id;
$data['manufacture_id']=$request->manufacture_id;
$data['product_short_description']=$request->product_short_description;
$data['product_long_description']=$request->product_long_description;
$data['product_price']=$request->product_price;
$data['product_size']=$request->product_size;
$data['product_image']=$request->product_image;
$data['product_color']=$request->product_color;
$data['publication_status']=$request->publication_status;
$image=$request->file('product_image');
if ($image) {
$image_name=str_random(20);
$ext=strtolower($image->getClientOriginalExtension());
$image_full_name=$image_name.'.'.$ext;
$upload_path='image/';
$image_url=$upload_path.$image_full_name;
$success=$image->move($upload_path,$image_full_name);
if ($success) {
$data['product_image']=$image_url;
DB::table('tbl_products')->insert($data);
Session::put('message','Product added Successfully!');
return Redirect::to('/add-product');
}
//echo "<pre>";
//print_r($data);
//echo "</pre>";
//exit();
}
$data['product_image']='';
DB::table('tbl_products')->insert($data);
Session::put('message','Product added Successfully! without image');
return Redirect::to('/add-product');
}
trying to solve the problem. I added in the if statement this code to see what I have in $data:
echo "<pre>";
print_r($data);
echo "</pre>";
exit();
But I had nothing. just blank page
then I added the same code before the last 4 lines. I received what in the array and data["product_image"] was empty.
This is the form (i did not forget to put enctype):
<form class="form-horizontal" action="{{ url('/save-product')}}" method="post" enctype="multipart/form-data">
{{ csrf_field() }}
<fieldset>
<div class="control-group">
<label class="control-label" for="date01">Product Name</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_name" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Category name</label>
<div class="controls">
<select id="selectError3" name="category_id">
<option>Select Category</option>
<?php
$all_published_category=DB::table('tbl_category')
->where('publication_status',1)
->get();
foreach($all_published_category as $v_category) {?>
<option>{{$v_category->category_name}}</option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Brand name</label>
<div class="controls">
<select id="selectError3" name="manufacture_id">
<option>Select Brand</option>
<?php
$all_published_manufacture=DB::table('tbl_manufacture')
->where('publication_status',1)
->get();
foreach($all_published_manufacture as $v_manufacture) {?>
<option>{{$v_manufacture->manufacture_name}}</option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Product Short Description</label>
<div class="controls">
<textarea class="cleditor" name="product_short_description" rows="3" required=""></textarea>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Product Long Description</label>
<div class="controls">
<textarea class="cleditor" name="product_long_description" rows="3" required=""></textarea>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Price</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_price" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="fileInput">Image</label>
<div class="controls">
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
</div>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Size</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_size" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Color</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_color" required="">
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Publication status </label>
<div class="controls">
<input type="checkbox" name="publication_status" value="1">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Add product</button>
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
thank you in advance!
php jquery html arrays laravel
|
show 1 more comment
I hope you are doing well. I am new with laravel. I have a problem with a code for adding a product.
The problem is exactly in product_image. I can't have the image and I keep receiving the message "Product added Successfully! without image"
public function save_product(Request $request)
{
$data=array();
$data['product_name']=$request->product_name;
$data['category_id']=$request->category_id;
$data['manufacture_id']=$request->manufacture_id;
$data['product_short_description']=$request->product_short_description;
$data['product_long_description']=$request->product_long_description;
$data['product_price']=$request->product_price;
$data['product_size']=$request->product_size;
$data['product_image']=$request->product_image;
$data['product_color']=$request->product_color;
$data['publication_status']=$request->publication_status;
$image=$request->file('product_image');
if ($image) {
$image_name=str_random(20);
$ext=strtolower($image->getClientOriginalExtension());
$image_full_name=$image_name.'.'.$ext;
$upload_path='image/';
$image_url=$upload_path.$image_full_name;
$success=$image->move($upload_path,$image_full_name);
if ($success) {
$data['product_image']=$image_url;
DB::table('tbl_products')->insert($data);
Session::put('message','Product added Successfully!');
return Redirect::to('/add-product');
}
//echo "<pre>";
//print_r($data);
//echo "</pre>";
//exit();
}
$data['product_image']='';
DB::table('tbl_products')->insert($data);
Session::put('message','Product added Successfully! without image');
return Redirect::to('/add-product');
}
trying to solve the problem. I added in the if statement this code to see what I have in $data:
echo "<pre>";
print_r($data);
echo "</pre>";
exit();
But I had nothing. just blank page
then I added the same code before the last 4 lines. I received what in the array and data["product_image"] was empty.
This is the form (i did not forget to put enctype):
<form class="form-horizontal" action="{{ url('/save-product')}}" method="post" enctype="multipart/form-data">
{{ csrf_field() }}
<fieldset>
<div class="control-group">
<label class="control-label" for="date01">Product Name</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_name" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Category name</label>
<div class="controls">
<select id="selectError3" name="category_id">
<option>Select Category</option>
<?php
$all_published_category=DB::table('tbl_category')
->where('publication_status',1)
->get();
foreach($all_published_category as $v_category) {?>
<option>{{$v_category->category_name}}</option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Brand name</label>
<div class="controls">
<select id="selectError3" name="manufacture_id">
<option>Select Brand</option>
<?php
$all_published_manufacture=DB::table('tbl_manufacture')
->where('publication_status',1)
->get();
foreach($all_published_manufacture as $v_manufacture) {?>
<option>{{$v_manufacture->manufacture_name}}</option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Product Short Description</label>
<div class="controls">
<textarea class="cleditor" name="product_short_description" rows="3" required=""></textarea>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Product Long Description</label>
<div class="controls">
<textarea class="cleditor" name="product_long_description" rows="3" required=""></textarea>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Price</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_price" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="fileInput">Image</label>
<div class="controls">
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
</div>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Size</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_size" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Color</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_color" required="">
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Publication status </label>
<div class="controls">
<input type="checkbox" name="publication_status" value="1">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Add product</button>
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
thank you in advance!
php jquery html arrays laravel
Can you post the result ofdd($request->all())
to see what you are sending as request data?
– Peter
Nov 21 '18 at 18:52
@peter this what I got . array:10 [▼ "_token" => "1FKKpUAOT7qRQKd2Vw0hnkE1bbDQfQS5cmHfOJRI" "product_name" => "ssdasd" "category_id" => "Men" "manufacture_id" => "koton" "product_short_description" => "sdfsadsads" "product_long_description" => "dsfsdfdsfds" "product_price" => "99" "product_size" => "dssad" "product_color" => "dsfsdfds" "publication_status" => "1" ]
– Aimen Qaissouni
Nov 21 '18 at 19:22
Can you post your form? It looks like your file is not getting uploaded. Perhaps check that you haveenctype="multipart/form-data"
included on your form.
– Peter
Nov 21 '18 at 20:09
@peter it is all good with the form. I already added enctpe="multipart/form_data". but there is no response. I added the form in the question. thank you peter for your time!
– Aimen Qaissouni
Nov 21 '18 at 21:43
OK, great. Can you retry thedd($request->all())
and see what that looks like now that you've added thename
attribute?
– Peter
Nov 21 '18 at 23:08
|
show 1 more comment
I hope you are doing well. I am new with laravel. I have a problem with a code for adding a product.
The problem is exactly in product_image. I can't have the image and I keep receiving the message "Product added Successfully! without image"
public function save_product(Request $request)
{
$data=array();
$data['product_name']=$request->product_name;
$data['category_id']=$request->category_id;
$data['manufacture_id']=$request->manufacture_id;
$data['product_short_description']=$request->product_short_description;
$data['product_long_description']=$request->product_long_description;
$data['product_price']=$request->product_price;
$data['product_size']=$request->product_size;
$data['product_image']=$request->product_image;
$data['product_color']=$request->product_color;
$data['publication_status']=$request->publication_status;
$image=$request->file('product_image');
if ($image) {
$image_name=str_random(20);
$ext=strtolower($image->getClientOriginalExtension());
$image_full_name=$image_name.'.'.$ext;
$upload_path='image/';
$image_url=$upload_path.$image_full_name;
$success=$image->move($upload_path,$image_full_name);
if ($success) {
$data['product_image']=$image_url;
DB::table('tbl_products')->insert($data);
Session::put('message','Product added Successfully!');
return Redirect::to('/add-product');
}
//echo "<pre>";
//print_r($data);
//echo "</pre>";
//exit();
}
$data['product_image']='';
DB::table('tbl_products')->insert($data);
Session::put('message','Product added Successfully! without image');
return Redirect::to('/add-product');
}
trying to solve the problem. I added in the if statement this code to see what I have in $data:
echo "<pre>";
print_r($data);
echo "</pre>";
exit();
But I had nothing. just blank page
then I added the same code before the last 4 lines. I received what in the array and data["product_image"] was empty.
This is the form (i did not forget to put enctype):
<form class="form-horizontal" action="{{ url('/save-product')}}" method="post" enctype="multipart/form-data">
{{ csrf_field() }}
<fieldset>
<div class="control-group">
<label class="control-label" for="date01">Product Name</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_name" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Category name</label>
<div class="controls">
<select id="selectError3" name="category_id">
<option>Select Category</option>
<?php
$all_published_category=DB::table('tbl_category')
->where('publication_status',1)
->get();
foreach($all_published_category as $v_category) {?>
<option>{{$v_category->category_name}}</option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Brand name</label>
<div class="controls">
<select id="selectError3" name="manufacture_id">
<option>Select Brand</option>
<?php
$all_published_manufacture=DB::table('tbl_manufacture')
->where('publication_status',1)
->get();
foreach($all_published_manufacture as $v_manufacture) {?>
<option>{{$v_manufacture->manufacture_name}}</option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Product Short Description</label>
<div class="controls">
<textarea class="cleditor" name="product_short_description" rows="3" required=""></textarea>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Product Long Description</label>
<div class="controls">
<textarea class="cleditor" name="product_long_description" rows="3" required=""></textarea>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Price</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_price" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="fileInput">Image</label>
<div class="controls">
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
</div>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Size</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_size" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Color</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_color" required="">
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Publication status </label>
<div class="controls">
<input type="checkbox" name="publication_status" value="1">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Add product</button>
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
thank you in advance!
php jquery html arrays laravel
I hope you are doing well. I am new with laravel. I have a problem with a code for adding a product.
The problem is exactly in product_image. I can't have the image and I keep receiving the message "Product added Successfully! without image"
public function save_product(Request $request)
{
$data=array();
$data['product_name']=$request->product_name;
$data['category_id']=$request->category_id;
$data['manufacture_id']=$request->manufacture_id;
$data['product_short_description']=$request->product_short_description;
$data['product_long_description']=$request->product_long_description;
$data['product_price']=$request->product_price;
$data['product_size']=$request->product_size;
$data['product_image']=$request->product_image;
$data['product_color']=$request->product_color;
$data['publication_status']=$request->publication_status;
$image=$request->file('product_image');
if ($image) {
$image_name=str_random(20);
$ext=strtolower($image->getClientOriginalExtension());
$image_full_name=$image_name.'.'.$ext;
$upload_path='image/';
$image_url=$upload_path.$image_full_name;
$success=$image->move($upload_path,$image_full_name);
if ($success) {
$data['product_image']=$image_url;
DB::table('tbl_products')->insert($data);
Session::put('message','Product added Successfully!');
return Redirect::to('/add-product');
}
//echo "<pre>";
//print_r($data);
//echo "</pre>";
//exit();
}
$data['product_image']='';
DB::table('tbl_products')->insert($data);
Session::put('message','Product added Successfully! without image');
return Redirect::to('/add-product');
}
trying to solve the problem. I added in the if statement this code to see what I have in $data:
echo "<pre>";
print_r($data);
echo "</pre>";
exit();
But I had nothing. just blank page
then I added the same code before the last 4 lines. I received what in the array and data["product_image"] was empty.
This is the form (i did not forget to put enctype):
<form class="form-horizontal" action="{{ url('/save-product')}}" method="post" enctype="multipart/form-data">
{{ csrf_field() }}
<fieldset>
<div class="control-group">
<label class="control-label" for="date01">Product Name</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_name" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Category name</label>
<div class="controls">
<select id="selectError3" name="category_id">
<option>Select Category</option>
<?php
$all_published_category=DB::table('tbl_category')
->where('publication_status',1)
->get();
foreach($all_published_category as $v_category) {?>
<option>{{$v_category->category_name}}</option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="selectError3">Brand name</label>
<div class="controls">
<select id="selectError3" name="manufacture_id">
<option>Select Brand</option>
<?php
$all_published_manufacture=DB::table('tbl_manufacture')
->where('publication_status',1)
->get();
foreach($all_published_manufacture as $v_manufacture) {?>
<option>{{$v_manufacture->manufacture_name}}</option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Product Short Description</label>
<div class="controls">
<textarea class="cleditor" name="product_short_description" rows="3" required=""></textarea>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Product Long Description</label>
<div class="controls">
<textarea class="cleditor" name="product_long_description" rows="3" required=""></textarea>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Price</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_price" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="fileInput">Image</label>
<div class="controls">
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
</div>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Size</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_size" required="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="date01">Product Color</label>
<div class="controls">
<input type="text" class="input-xlarge" name="product_color" required="">
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Publication status </label>
<div class="controls">
<input type="checkbox" name="publication_status" value="1">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Add product</button>
<button type="reset" class="btn">Cancel</button>
</div>
</fieldset>
</form>
thank you in advance!
php jquery html arrays laravel
php jquery html arrays laravel
edited Nov 21 '18 at 22:36
Aimen Qaissouni
asked Nov 21 '18 at 18:28
Aimen QaissouniAimen Qaissouni
25
25
Can you post the result ofdd($request->all())
to see what you are sending as request data?
– Peter
Nov 21 '18 at 18:52
@peter this what I got . array:10 [▼ "_token" => "1FKKpUAOT7qRQKd2Vw0hnkE1bbDQfQS5cmHfOJRI" "product_name" => "ssdasd" "category_id" => "Men" "manufacture_id" => "koton" "product_short_description" => "sdfsadsads" "product_long_description" => "dsfsdfdsfds" "product_price" => "99" "product_size" => "dssad" "product_color" => "dsfsdfds" "publication_status" => "1" ]
– Aimen Qaissouni
Nov 21 '18 at 19:22
Can you post your form? It looks like your file is not getting uploaded. Perhaps check that you haveenctype="multipart/form-data"
included on your form.
– Peter
Nov 21 '18 at 20:09
@peter it is all good with the form. I already added enctpe="multipart/form_data". but there is no response. I added the form in the question. thank you peter for your time!
– Aimen Qaissouni
Nov 21 '18 at 21:43
OK, great. Can you retry thedd($request->all())
and see what that looks like now that you've added thename
attribute?
– Peter
Nov 21 '18 at 23:08
|
show 1 more comment
Can you post the result ofdd($request->all())
to see what you are sending as request data?
– Peter
Nov 21 '18 at 18:52
@peter this what I got . array:10 [▼ "_token" => "1FKKpUAOT7qRQKd2Vw0hnkE1bbDQfQS5cmHfOJRI" "product_name" => "ssdasd" "category_id" => "Men" "manufacture_id" => "koton" "product_short_description" => "sdfsadsads" "product_long_description" => "dsfsdfdsfds" "product_price" => "99" "product_size" => "dssad" "product_color" => "dsfsdfds" "publication_status" => "1" ]
– Aimen Qaissouni
Nov 21 '18 at 19:22
Can you post your form? It looks like your file is not getting uploaded. Perhaps check that you haveenctype="multipart/form-data"
included on your form.
– Peter
Nov 21 '18 at 20:09
@peter it is all good with the form. I already added enctpe="multipart/form_data". but there is no response. I added the form in the question. thank you peter for your time!
– Aimen Qaissouni
Nov 21 '18 at 21:43
OK, great. Can you retry thedd($request->all())
and see what that looks like now that you've added thename
attribute?
– Peter
Nov 21 '18 at 23:08
Can you post the result of
dd($request->all())
to see what you are sending as request data?– Peter
Nov 21 '18 at 18:52
Can you post the result of
dd($request->all())
to see what you are sending as request data?– Peter
Nov 21 '18 at 18:52
@peter this what I got . array:10 [▼ "_token" => "1FKKpUAOT7qRQKd2Vw0hnkE1bbDQfQS5cmHfOJRI" "product_name" => "ssdasd" "category_id" => "Men" "manufacture_id" => "koton" "product_short_description" => "sdfsadsads" "product_long_description" => "dsfsdfdsfds" "product_price" => "99" "product_size" => "dssad" "product_color" => "dsfsdfds" "publication_status" => "1" ]
– Aimen Qaissouni
Nov 21 '18 at 19:22
@peter this what I got . array:10 [▼ "_token" => "1FKKpUAOT7qRQKd2Vw0hnkE1bbDQfQS5cmHfOJRI" "product_name" => "ssdasd" "category_id" => "Men" "manufacture_id" => "koton" "product_short_description" => "sdfsadsads" "product_long_description" => "dsfsdfdsfds" "product_price" => "99" "product_size" => "dssad" "product_color" => "dsfsdfds" "publication_status" => "1" ]
– Aimen Qaissouni
Nov 21 '18 at 19:22
Can you post your form? It looks like your file is not getting uploaded. Perhaps check that you have
enctype="multipart/form-data"
included on your form.– Peter
Nov 21 '18 at 20:09
Can you post your form? It looks like your file is not getting uploaded. Perhaps check that you have
enctype="multipart/form-data"
included on your form.– Peter
Nov 21 '18 at 20:09
@peter it is all good with the form. I already added enctpe="multipart/form_data". but there is no response. I added the form in the question. thank you peter for your time!
– Aimen Qaissouni
Nov 21 '18 at 21:43
@peter it is all good with the form. I already added enctpe="multipart/form_data". but there is no response. I added the form in the question. thank you peter for your time!
– Aimen Qaissouni
Nov 21 '18 at 21:43
OK, great. Can you retry the
dd($request->all())
and see what that looks like now that you've added the name
attribute?– Peter
Nov 21 '18 at 23:08
OK, great. Can you retry the
dd($request->all())
and see what that looks like now that you've added the name
attribute?– Peter
Nov 21 '18 at 23:08
|
show 1 more comment
1 Answer
1
active
oldest
votes
Check your code
<input class="input-file uniform_on" id="product_image" type="file">
There is no name attributes. Add it and problem solved.
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
I added it, but still have the same problem...
– Aimen Qaissouni
Nov 21 '18 at 22:35
Your code is working fine here. Trying usingdd($anyVariable)
at various points to know where the code breaks.
– KENZiE
Nov 21 '18 at 23:02
Now it works. it was the name attribute as you said! thank you KENZIE!! and it is my first time knowing dd($anyvariable) thanks again
– Aimen Qaissouni
Nov 21 '18 at 23:23
You are welcome @AimenQaissouni ... Keep coding.
– KENZiE
Nov 22 '18 at 7:57
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418423%2fproblem-with-uploading-image-code-laravel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Check your code
<input class="input-file uniform_on" id="product_image" type="file">
There is no name attributes. Add it and problem solved.
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
I added it, but still have the same problem...
– Aimen Qaissouni
Nov 21 '18 at 22:35
Your code is working fine here. Trying usingdd($anyVariable)
at various points to know where the code breaks.
– KENZiE
Nov 21 '18 at 23:02
Now it works. it was the name attribute as you said! thank you KENZIE!! and it is my first time knowing dd($anyvariable) thanks again
– Aimen Qaissouni
Nov 21 '18 at 23:23
You are welcome @AimenQaissouni ... Keep coding.
– KENZiE
Nov 22 '18 at 7:57
add a comment |
Check your code
<input class="input-file uniform_on" id="product_image" type="file">
There is no name attributes. Add it and problem solved.
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
I added it, but still have the same problem...
– Aimen Qaissouni
Nov 21 '18 at 22:35
Your code is working fine here. Trying usingdd($anyVariable)
at various points to know where the code breaks.
– KENZiE
Nov 21 '18 at 23:02
Now it works. it was the name attribute as you said! thank you KENZIE!! and it is my first time knowing dd($anyvariable) thanks again
– Aimen Qaissouni
Nov 21 '18 at 23:23
You are welcome @AimenQaissouni ... Keep coding.
– KENZiE
Nov 22 '18 at 7:57
add a comment |
Check your code
<input class="input-file uniform_on" id="product_image" type="file">
There is no name attributes. Add it and problem solved.
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
Check your code
<input class="input-file uniform_on" id="product_image" type="file">
There is no name attributes. Add it and problem solved.
<input class="input-file uniform_on" name="product_image" id="product_image" type="file">
answered Nov 21 '18 at 22:15
KENZiEKENZiE
1246
1246
I added it, but still have the same problem...
– Aimen Qaissouni
Nov 21 '18 at 22:35
Your code is working fine here. Trying usingdd($anyVariable)
at various points to know where the code breaks.
– KENZiE
Nov 21 '18 at 23:02
Now it works. it was the name attribute as you said! thank you KENZIE!! and it is my first time knowing dd($anyvariable) thanks again
– Aimen Qaissouni
Nov 21 '18 at 23:23
You are welcome @AimenQaissouni ... Keep coding.
– KENZiE
Nov 22 '18 at 7:57
add a comment |
I added it, but still have the same problem...
– Aimen Qaissouni
Nov 21 '18 at 22:35
Your code is working fine here. Trying usingdd($anyVariable)
at various points to know where the code breaks.
– KENZiE
Nov 21 '18 at 23:02
Now it works. it was the name attribute as you said! thank you KENZIE!! and it is my first time knowing dd($anyvariable) thanks again
– Aimen Qaissouni
Nov 21 '18 at 23:23
You are welcome @AimenQaissouni ... Keep coding.
– KENZiE
Nov 22 '18 at 7:57
I added it, but still have the same problem...
– Aimen Qaissouni
Nov 21 '18 at 22:35
I added it, but still have the same problem...
– Aimen Qaissouni
Nov 21 '18 at 22:35
Your code is working fine here. Trying using
dd($anyVariable)
at various points to know where the code breaks.– KENZiE
Nov 21 '18 at 23:02
Your code is working fine here. Trying using
dd($anyVariable)
at various points to know where the code breaks.– KENZiE
Nov 21 '18 at 23:02
Now it works. it was the name attribute as you said! thank you KENZIE!! and it is my first time knowing dd($anyvariable) thanks again
– Aimen Qaissouni
Nov 21 '18 at 23:23
Now it works. it was the name attribute as you said! thank you KENZIE!! and it is my first time knowing dd($anyvariable) thanks again
– Aimen Qaissouni
Nov 21 '18 at 23:23
You are welcome @AimenQaissouni ... Keep coding.
– KENZiE
Nov 22 '18 at 7:57
You are welcome @AimenQaissouni ... Keep coding.
– KENZiE
Nov 22 '18 at 7:57
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418423%2fproblem-with-uploading-image-code-laravel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you post the result of
dd($request->all())
to see what you are sending as request data?– Peter
Nov 21 '18 at 18:52
@peter this what I got . array:10 [▼ "_token" => "1FKKpUAOT7qRQKd2Vw0hnkE1bbDQfQS5cmHfOJRI" "product_name" => "ssdasd" "category_id" => "Men" "manufacture_id" => "koton" "product_short_description" => "sdfsadsads" "product_long_description" => "dsfsdfdsfds" "product_price" => "99" "product_size" => "dssad" "product_color" => "dsfsdfds" "publication_status" => "1" ]
– Aimen Qaissouni
Nov 21 '18 at 19:22
Can you post your form? It looks like your file is not getting uploaded. Perhaps check that you have
enctype="multipart/form-data"
included on your form.– Peter
Nov 21 '18 at 20:09
@peter it is all good with the form. I already added enctpe="multipart/form_data". but there is no response. I added the form in the question. thank you peter for your time!
– Aimen Qaissouni
Nov 21 '18 at 21:43
OK, great. Can you retry the
dd($request->all())
and see what that looks like now that you've added thename
attribute?– Peter
Nov 21 '18 at 23:08