Nitarm Nope wrote on Monday 18th of July 2011:I'm getting this error "Fuel\Core\Fuel_Exception [ Error ]: No uploaded files are selected." when im trying to set-up an upload image.. is there something i miss? I already set the path of my upload but its always appearing on same error. -CONTROLLER- function action_submit()
{
if(Input::method()== 'POST')
{
Upload::get_files();
Upload::save();
}
} -MY VIEW- echo Form::open('welcome/submit',array('enctype'=>'multipart/form-data'));
echo Html::br(1).Form::input(array('name'=>'img_url','type'=>'file')).Html::br(1);
echo Html::br(1).Form::submit('Submit');?>
Could you explain for others how do you solved a problem?Nitarm Nope wrote on Monday 18th of July 2011:Thanks huglester and WanWizard for the advice..
I found my error in my form by looking view page source on my browser
i wrote this : Form::open('welcome/submit',array('enctype'=>'multipart/form-data')); which produce in html like this.. <form action="http://localhost/welcome/submit" accept-charset="utf-8" method="post">
<input name="enctype" value="multipart/form-data" type="hidden" id="form_enctype" /> which will definitely error "no uploaded files are selected"
Form::open( array('action' => 'welcome/submit', 'enctype' => 'multipart/form-data') );
I am not found a problem in code.Harro Verton wrote on Sunday 4th of September 2011:The error here is that the Form::open() method is used wrong. It accepts either a URI as first parameter, or an array with tag attributes. So you need to pass an array if you have more then only the URI:
Form::open( array('action' => 'welcome/submit', 'enctype' => 'multipart/form-data') );
echo Form::open('welcome/submit',array('enctype'=>'multipart/form-data'));
echo Form::open( array('action' => 'welcome/submit', 'enctype' => 'multipart/form-data') );
Part of my code:Harro Verton wrote on Tuesday 6th of September 2011:I don't understand. The TS wrote that he used this code:
echo Form::open('welcome/submit',array('enctype'=>'multipart/form-data'));
and that generates the incorrect HTML, as shown above. You asked how that issue was fixed, to which I replied that it needs to be coded like this:
echo Form::open( array('action' => 'welcome/submit', 'enctype' => 'multipart/form-data') );
/in controller: function action_submit() { if(isset($_POST)) { $config = array( 'path' => DOCROOT.DS.'files', 'randomize' => true, 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'), ); \Fuel\Core\Upload::process($config); if(\Fuel\Core\Upload::save()) { echo 'Everything ok, img saved'; } else { echo 'Something wrong in code'; } } else { echo 'NO $_post'; } }
<?php echo Form::open(array('action' => 'upload/submit', 'method'=>'Post', 'enctype'=>'multipart/form-data')); echo Html::br(1).Form::input(array('name'=>'img_url','type'=>'file')).Html::br(1); echo Html::br(1).Form::submit('Submit');?>
It looks like you're new here. If you want to get involved, click one of these buttons!