Getting files that uploaded to database to show on edit form

Posted 10 months ago by Hourlee

I have a CreateProjectLayout which allows user to upload related files into my database. I also have an EditProjectLayout which get all the data from the database to show in each form field. I want to know how to get files that uploaded to show in the form field.


                                    <input type="file" id="files" ref="files" multiple v-on:change="handleFiles()"/>


                                <div v-for="(file, key) in files" class="file-listing">
                                    <img class="preview" v-bind:ref="'preview'+parseInt(key)"/>
                                    {{ file.name }}
                                    <div class="success-container" v-if="file.id > 0">
                                        <input type="hidden" :name="input_name" :value="file.id"/>
                                    <div class="remove-container" v-else>
                                        <a class="btn btn-danger" type="button" v-on:click="removeFile(key)">Remove</a>

axios.get('/projects/project/'+app.$route.params.id) .then(function (response) { var data = response.data app.ID = data.id app.projectName = data.project_name app.totalPrice = data.total_price app.start_date = data.start_date app.end_date = data.end_date app.categoryData = data.project_category_id app.customerData = data.customer_id app.description = data.description app.rows = data.scopes app.files = ?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.