Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

file upload in laravel

$design_file_name=null;
        if($request->image != null){
            $design_file_name ="clinic_" . md5(time()) . "_" . $request->image->getClientOriginalName();
            $design_file_path = "clinic_" . md5(time()) . "_" . $request->image->getClientOriginalName();
            $path = public_path().'/storage/clinic';
            $uplaod = $request->image->move($path,$design_file_name);
        } 
#HTML
 <div class="col-lg-6 col-md-6">
                    <div class="form-group">
                        <div class="choose-file">
                            <label for="image">
                                <div>{{__('Choose file here')}}</div>
                                <input class="form-control" name="image" type="file" id="image" accept="image/*" data-filename="profile_update">
                            </label>
                            <p class="profile_update"></p>
                        </div>
                        @error('avatar')
                        <span class="invalid-feedback text-danger text-xs" role="alert">{{ $message }}</span>
                        @enderror
                    </div>
                    <span class="clearfix"></span>
                    <span class="text-xs text-muted">{{ __('Please upload a valid image file. Size of image should not be more than 2MB.')}}</span>
                </div>

               
                <input type="submit" value="{{__('Save')}}"  class="btn-create badge-blue">
               
            </div>
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #file #upload #laravel
ADD COMMENT
Topic
Name
7+8 =