How to Create a File Upload Field

The Form::file() method works exactly the same as the Form::input() method except that it automatically sets the type attribute to file and it doesn't accept a value parameter.

echo Form::file('name');
<input type="file" name="name" />

The second parameter accepts an array of attributes

echo Form::file('name', array('disabled'=>TRUE));
<input type="file" name="name" disabled="1" />

The form encoding type must be multipart/form-data. So call Form::open() with the attribute enctype.

echo Form::open(NULL, array('enctype' => 'multipart/form-data'));
how_to_create_a_file_upload_field.txt · Last modified: 2010/08/23 08:36 by lirum