Welcome Guest, Not a member yet? Register   Sign In
Problem with the upload class
#1

[eluser]chzigkol[/eluser]
Edit: I found that I cannot upload a file via an ajax call. Can you suggest me a plugin that uses jquery library?

When I try to upload an image, I get this error

"You did not select a file to upload."

This is my view:

<div id="picturesContainerCreate">
&lt;?php
$picturesUriFileCreate = array(
'name' => 'pictureuri',
'id' => 'pictureuri',
'value' => set_value('pictureuri')
);
$picturesSubmitCreate = array(
'name' => 'picturesSubmit',
'id' => 'picturesSubmit',
'value' => 'Create Picture',
'content' => 'Upload Picture'
);
?&gt;

&lt;?php echo form_upload($picturesUriFileCreate);?&gt;
<br/>
&lt;?php echo form_submit($picturesSubmitCreate);?&gt;

</div>

And this is the code in my controller:

$config['upload_path'] = $this->config->item('root_url'). 'media/images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '4096';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload()) {
$error = $this->upload->display_errors();
echo $error;
}
else {
$fileInfo = $this->upload->data();
$options['uri'] = $fileInfo['file_name'];
$returnId = $this->Pictures_model->createPictures($options);
echo "The image with the name " . $options['uri'] . " has been successfully uploaded";
}
#2

[eluser]Zack Kitzmiller[/eluser]
Most likely you're not sending your form as multipart/form-data, infact, I don't see that your form is opened at all...

Code:
&lt;form action="" method="post" enctype="multipart/form-data"&gt;

&lt;input type="upload" name="pictureuri" /&gt;
&lt;input type="sumbit" name="submit" /&gt;
&lt;/form&gt;

might be a good starting point.
#3

[eluser]chzigkol[/eluser]
no I m using ajax call. And i can't send a file via this kind of call. i have to use a specific plugin
#4

[eluser]Zack Kitzmiller[/eluser]
Best of luck to you then...
#5

[eluser]Namaless[/eluser]
Can't use Ajax Call to use CI Upload Class.

Extend Upload Class for uploading with Ajax :-)
#6

[eluser]fajarsulaksono[/eluser]
[quote author="chzigkol" date="1260147146"]Edit: I found that I cannot upload a file via an ajax call. Can you suggest me a plugin that uses jquery library?

When I try to upload an image, I get this error

"You did not select a file to upload."

[/quote]

hi chzigkol

i use the jquery multiple upload file plugin and i got the same error with you "You did not select a file"
i use the html validator addons for firefox and i found it caused by the invalid html markup, i have the &lt;form&gt; tag inside the <table> tag, after i fix it the upload is running without error.

thx




Theme © iAndrew 2016 - Forum software by © MyBB