This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
    noxioustoo34847
    
            
            
                    
                                            
        
    
        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');
    $form->save();
    // 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>
</form>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