Search code examples
file-uploadvuejs3inertiajs

Is it possible to use Inertia form helper for upload files so, that no file input is involved?


WHat I did is, that through drag' drop i took the value of dataTransfer files, and made form files field equal to that:

const form = useForm({
    files: [],
});
form.files = e.dataTransfer.files;

Is this a valid method, or for some reason it is mandatory to use file input?


Solution

  • e.dataTransfer.files is a perfectly valid way to access the file list, especially within a drag and drop operation. You're doing it right.