Problem with the upload class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Problem with the upload class (/showthread.php?tid=25272) |
Problem with the upload class - El Forum - 12-06-2009 [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"> <?php $picturesUriFileCreate = array( 'name' => 'pictureuri', 'id' => 'pictureuri', 'value' => set_value('pictureuri') ); $picturesSubmitCreate = array( 'name' => 'picturesSubmit', 'id' => 'picturesSubmit', 'value' => 'Create Picture', 'content' => 'Upload Picture' ); ?> <?php echo form_upload($picturesUriFileCreate);?> <br/> <?php echo form_submit($picturesSubmitCreate);?> </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"; } Problem with the upload class - El Forum - 12-06-2009 [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: <form action="" method="post" enctype="multipart/form-data"> might be a good starting point. Problem with the upload class - El Forum - 12-06-2009 [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 Problem with the upload class - El Forum - 12-06-2009 [eluser]Zack Kitzmiller[/eluser] Best of luck to you then... Problem with the upload class - El Forum - 12-07-2009 [eluser]Namaless[/eluser] Can't use Ajax Call to use CI Upload Class. Extend Upload Class for uploading with Ajax :-) Problem with the upload class - El Forum - 12-07-2009 [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 <form> tag inside the <table> tag, after i fix it the upload is running without error. thx |