johndoee's avatar

why upload image input value not read

I try to custom some codes . it is offline payment here is blade form

 <div class="tab-pane fade" id="payment-tab-offline">
                        <div class="offline-payment-form-wrap pt-2 pb-5">

                            <form action="{{route('pay_offline')}}" method="post">
                                 @csrf

                                <div class="form-group">

                                    <label>Write about your payment method </label>

                                    <textarea class="form-control" name="payment_note"></textarea>
                                    <p class="text-muted">
                                        <small>
                                            Write your payment method in details, elobrate as much as you can. We will verify payment and you will get course access after payment verification.
                                        </small>
                                    </p>

                                    <div class="col-md-4 image-funs pranto">
                                        <div class="form-group" style=" 
                                       padding: 40px !important;
                                       margin-bottom: 8px !important;
                                       padding-bottom: 5px !important;">
                                            <label>Upload Image</label>
                                            <img id='img-upload' style="height: 10px !important;"/>
                                           

                                            <div class="input-group">
                                               <span class="input-group-btn">
                                               <span class="btn btn-default btn-file  responsive-file-upload">
                                                        <input type="file" name="image" id="imgInp">
                                              </span>
                                              </span>

                                            </div>
                                        </div>

                                </div>
                             


                                <p>
                                    <button type="submit" class="btn btn-purple btn-lg" id="offline-payment-form-btn">
                                        <span class="enroll-course-btn-text mr-4 border-right pr-4">
                                            <i class="la la-wallet"></i> Pay with Offline Payment
                                        </span>
                                        <span class="enroll-course-btn-price">
                                            {!! price_format($cart->total_amount) !!}
                                        </span>
                                    </button>
                                </p>
                            </form>

                        </div>

                    </div>

here log file

 local.ERROR: Undefined variable: filename {"userId":9,"exception":"[object] (ErrorException(code: 0): Undefined variable: filename at C:\Users\PC\Desktop\source\app\Http\Controllers\GatewayController.php:233)
[stacktrace]

problem is cannot get value from image although upload from blade file. what wrong in codes plz help.

0 likes
1 reply
Snapey's avatar
Snapey
Best Answer
Level 122

add enctype to your form tag enctype="multipart/form-data"

1 like

Please or to participate in this conversation.