This code is useful for situations when you have a form with huge number of fields.

function onSubmit()
    // get all post data
    $data = post();
    $form = YourModel::make($data);
    // set specific field as we need
    $form->form_files = Input::file('form_files');

    // Note:
    // $data = post();
    // $data['form_files'] = Input::file('form_files');  <-- this won't work!
    // YourModel::create($data);
<form data-request="onSubmit" data-request-files>
    <input type="file" name="form_files">
    <input type="submit>

That's it.

If you need to upload multiple files add this attribute to the form: enctype='multipart/form-data' and multiple to the file input.

1-1 of 1