*I want to upload a file from a form, and in the CMS system it impresses me that the file is 0 bytes - I need help viewing the file *
html file:
{{ form_ajax('contactfrom::onSend', { files: 'true', flash: 'true', 'data-request-files':true, 'data-request-validate': true }) }}
<form action="ContactForm.php" method="post" data-request="contactfrom::onSend" enctype="multipart/form-data" data-request-validate data-request-files>
<div class="form-group">
<label>Your name</label>
<input type="name" name="name" id="yourName" class="form-control" placeholder="Full Name" required />
</div>
<div class="form-group">
<label>file input</label>
<input type="file" name="file" id="file" class="form-control-file" accept=".jpg, .jpeg, .png" multiple="multiple" />
</div>
<button align="right" type="sumbit" name="post" class="btn btn-success" value="Post" style="float: right;" ;>
Create
</button>
</form>
{{ form_close() }}
php file:
public function onSend() {
$vars = [
'name' => Input::get('name'),
'file' =>Input::file('file'),
'content'=> Input::get('content')
];
$infri = new Infringement();
$infri->name = Input::get('name');
$infri->file = Input::file('file');
$infri->save();
}
and I put:
public $attachOne = [
'file' => 'System\Models\File'
];
and i see in my octoberCMS - file - 0 byte. and if i try check the file :
if(Input::has("file")) {
echo ", #>file";
} else {
echo ", no file";
}
is return "#>file" . please help.