Skip to content

File Uploading

Fatih Koca edited this page Nov 27, 2019 · 1 revision

fileInputs setting should be DOM object <input type="file">. We recommend using the post method when uploading files.

The important thing here is that you should not forget the name attribute.

HTML:

<input type="file" name="my-input" id="my-input">

Vue.js:

Vue.ajax.post("http://example.com", {}, {
    fileInputs: [
        document.getElementById("my-input")
    ]
});

You can only add the accept attribute to send images.

<input type="file" name="my-input-2" id="my-input-2" accept="image/*">

You can add the multiple attribute to send multiple files with an input element:

<input type="file" name="my-input-3" id="my-input-3" multiple>
Clone this wiki locally