Welcome Guest, Not a member yet? Register   Sign In
multiple file upload (Upload Class)
#1

[eluser]Ngulo[/eluser]
hi all guys

i've a problem uploading 2 files from inputs

i have these in my view
Code:
<?php echo form_open_multipart('admin/upload');?>
            File Zip
            <input type="file" name="zip"/><br>
                Image Png
                <input type="file" name="png"/><br>
            <input type="submit" value="Upload"/><br>
            <select name="dir_scelta">
                <option  value="Joomla" >Joomla</option>
                <option value="Wordpress" >Wordpress</option>
                <option value="Drupal" >Drupal</option>
            </select><br>
            &lt;?php if(isset($messaggio)){echo $messaggio;} ?&gt;
        &lt;/form&gt;


my controller is this
Code:
class Upload extends Controller
{
    function index()
    {
        //upload dei templates e delle immagini
                $scelgo_dir=htmlentities($this->input->post('dir_scelta'));
                $config['upload_path'] = 'upload/'.$scelgo_dir.'/';
        $config['allowed_types'] = 'zip|png';
        
        
        
        $this->load->library('upload', $config);
            
                
                
        if ( $this->upload->do_upload(array('zip','png')))
        {

                $data['messaggio']='il file รจ stato caricato';
        $this->load->view('admin/admin_view', $data);
        }    
        else
        {
                    
            $data['messaggio'] = 'Il file deve avere una estensione<br> di tipo .png o .zip ';
            
            $this->load->view('admin/admin_view', $data);
        }

    }
}

now it doesn't works any suggestion to do something like this:
Code:
$this->upload->do_upload(array('zip','png'))

??

thanks Wink
#2

[eluser]danmontgomery[/eluser]
Code:
if($this->upload->do_upload('zip') && $this->upload->do_upload('png')) {
#3

[eluser]Ngulo[/eluser]
hi noctrum ,really thanks for speed answer Big Grin

i've just tryed your code but ,it dosen't works again ,it does uploads me,the only png file and it duplicate the same png

for example it does uploads:
asd.png
asd.png.png

:O ??

did you know why?
#4

[eluser]Ngulo[/eluser]
i have to say that all works great but when uploading png file looks good but .zip files comes me as asd.zip.png :coolcheese:

what's going on?

thanks to anyone who can response me Smile
#5

[eluser]evolutionxbox[/eluser]
What if you rename the files afterwards to just .zip (no .png). Do they open?
#6

[eluser]Ngulo[/eluser]
hi man,i don't understand what your meaning,sorry but i have problems with english language.....did you mean to rename files after i've uploaded them?




Theme © iAndrew 2016 - Forum software by © MyBB