CodeIgniter Forums
You Did Not Select A File To Upload. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: You Did Not Select A File To Upload. (/showthread.php?tid=22859)



You Did Not Select A File To Upload. - El Forum - 09-22-2009

[eluser]Zack Kitzmiller[/eluser]
I've seen messages on this, but no resolution.

Controller:
Code:
function index()
    {
    
        /* For now, all work will be done in controller */
        /* so sue me */
        
        $this->load->view('upload');
        
    }
    
    function upload() {
        
        echo "<pre>\n";
        print_r($_POST);
        print_r($_FILES);
    
    
        if ($this->input->post('upload_file')) {
    
            $config['upload_path'] = './uploads';
            $config['max_size'] = '2048';
            $this->load->library('upload', $config);
            
            if ($this->upload->do_upload('printery')) {
                print_r( $this->upload->data() );
            } else {
                print_r( $this->upload->display_errors() );    
            }        
        }
    }

The View:

Code:
&lt;form method="post" action="/index.php/welcome/upload" enctype="multipart/form-data" /&gt;

<div class="form_description">
    <h2>Get Started...</h2>
    <ul >
        <li>
            <label class="description" for="name">Your Name </label>
            &lt;input id="name" name="usr-name" class="element text medium" type="text" maxlength="255" value=""/&gt;
        </li>
        <li>
            <label class="description" for="email">Your Email </label>
            &lt;input id="email" name="email" class="element text medium" type="text" maxlength="255" value=""/&gt;
        </li>
        <li>
            <label class="description" for="element_2">Upload a File </label>
            &lt;input type="file" id="element_2" class="element file" name="printery" /&gt;
        </li>
        <li>
            &lt;input id="saveForm" class="button_text" type="submit" name="upload_file" value="Submit" /&gt;
        </li>
    </ul>
&lt;/form&gt;

Don't worry about the horrible horrible horrible class and id names. This form was given to me. I'll fix them later.

Any idea why i'm getting that error?


You Did Not Select A File To Upload. - El Forum - 09-22-2009

[eluser]Zack Kitzmiller[/eluser]
Resolved, I'm an idiot.


You Did Not Select A File To Upload. - El Forum - 09-25-2009

[eluser]Mahmoud M. Abdel-Fattah[/eluser]
can you share how did you solve it ?


You Did Not Select A File To Upload. - El Forum - 09-25-2009

[eluser]Zack Kitzmiller[/eluser]
You have to specify a max height and width. Just set them to 0 for no restrictions.