[eluser]Ricola[/eluser]
i have problem when i submit my jquery form to store my data but everything done fine !
except my file field , and i got a error message " You did not select a file to upload. ".
I actually tested this code with a simple html and without using jquery everything work fine also
including my file can be stored .
I'm using Codeigniter 2.0
This is my controller
Code:
public function create()
{
$config['upload_path'] = './public/images';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('pPicture'))
{
$error = array('error' => $this->upload->display_errors());
echo $error;
}
else
{
$data = array('upload_data' => $this->upload->data());
echo $data;
}
}
and this is a part of my view file
Code:
<div id="create">
<form method="post" enctype="multipart/form-data" />
<p>
<label for="name">Name:</label>
<input type="text" id="pName" name="pName" />
</p>
<p>
<label for="productpicture">Picture:</label>
<input type="file" name="pPicture" id="pPicture" size="200" />
</p>
<p>
<label> </label>
<input type="submit" name="createSubmit" value="Submit" />
</p>
</form>
</div>
and this is a part of my jquery file
Code:
submitHandler: function( form ) {
$( '#ajaxLoadAni' ).fadeIn( 'slow' );
$.ajax({
url: 'administrator/product/create',
type: 'POST',
data: $( form ).serialize(),
...
As i said every field can be stored ! except file field
Hope you guys could give me any suggestion because i already stuck in this part for 3 days.
Thanks in advanced