Hujjat / laravStart

Starter AdminLTE3 with Laravel 5.7 and Vuejs 2+
https://www.youtube.com/playlist?list=PLB4AdipoHpxaHDLIaMdtro1eXnQtl_UvE
380 stars 266 forks source link

How to image upload in vform #10

Open blpraveen opened 5 years ago

blpraveen commented 5 years ago

I need to upload an image in vform.

  <form @submit.prevent="editmode ? updatePost() : createPost()">
  <div class="modal-body">
 <div class="form-group">
    <input v-model="form.title" id="title" type="text" name="title"
        placeholder="Title"
        class="form-control" :class="{ 'is-invalid': form.errors.has('title') }">
    <has-error :form="form" field="title"></has-error>
   </div>

 <div class="form-group">
    <input v-model="form.featured" id="featured" type="file" name="featured"
        placeholder="Featured Image" @change="selectFile"
        class="form-control" :class="{ 'is-invalid': form.errors.has('featured') }">
    <has-error :form="form" field="featured"></has-error>
</div>
 </div>
   <div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
<button v-show="editmode" type="submit" class="btn btn-success">Update</button>
<button v-show="!editmode" type="submit" class="btn btn-primary">Create</button>
    </div>
   </form>