Welcome Guest, Not a member yet? Register   Sign In
i cant upload any thing except picture
#21

[eluser]Sara rad[/eluser]
when i try upload screen singly script worked good and screen uploaded bun when i want upload source (singly) script don't worked and show this error :

Quote: The filetype you are attempting to upload is not allowed.
#22

[eluser]allaerd[/eluser]
If i look at the code of the uploading class, you can not put an array in the do_upload part.

I would suggest you call it twice
Code:
if( ! $this->upload->do_upload('screen')) {
.....
}


if( ! $this->upload->do_upload('source')) {
.....
}
#23

[eluser]Sara rad[/eluser]
i test it , screen uploaded but source :

Quote:The filetype you are attempting to upload is not allowed.

Afterward i select a image(jpg) instead of (psd|zip|...) its worked with first config and file uploaded to first config path !

then config mode is wrong , any idea !? :question:
#24

[eluser]allaerd[/eluser]
It maybee sound silly. But i had a problem once because the extension was in capitals....

Can you check? Else mail me youre vire and controller and i will fix it here.
#25

[eluser]Sara rad[/eluser]
ok Big Grin i change controller to this it's worked good .

thank you friends :kiss: .

Code:
// Set upload rules for screen
$config['upload_path'] = 'files/shop/';
$config['allowed_types'] = 'jpg|png|gif';
$config['max_size']    = '200';
$config['max_width']  = '1024';
$config['max_height']  = '768';

// Set upload rules for source
$config['source']['upload_path'] = 'files/shop/source/';
$config['source']['allowed_types'] = 'zip|rar|cdr|psd|ai';
$config['source']['max_size']    = '24000';

// Select random name
$data['art_saved_name'] = $this->send_art_model->select_rand_name('arts_for_sell');

// Set name for saveing file
$config['file_name']  = $data['art_saved_name'];
$config['source']['file_name']  = $data['art_saved_name'];

// END OF RULES SETTING --

// Load Upload Library
$this->load->library('upload');

$this->upload->initialize($config);
if( ! $this->upload->do_upload('screen'))
{
    echo('Screen error :' . $this->upload->display_errors() . '---<br>');
}

$this->upload->initialize($config['source']);
if ( ! $this->upload->do_upload('source'))
{
    die('Source error :' . $this->upload->display_errors());
}
#26

[eluser]allaerd[/eluser]
i made it a bit more simple. But it works for me. See allaerd.org/test

view:
Code:
<!DOCTYPE html>
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Welcome to CodeIgniter&lt;/title&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;?php echo form_open_multipart('welcome/final_step'); ?&gt;
<p>
    Select art screen :
    &lt;input type="file" name="screen" size="10"&gt; ( jpeg , jpg , png , gif )
</p>    
<p>
    Select art source :
    &lt;input type="file" name="source" size="10"&gt; ( psd , zip , rar , cdr , ai )
</p>
<p align="center">
    &lt;input class="btn" type="submit" value="Submit" name="send_art"&gt;
</p>
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

controller:
Code:
function final_step () {
        
        // Load Upload Library
        $this->load->library('upload');
        // Set upload rules for screen
        $config['upload_path'] = '../files/shop/';
        $config['allowed_types'] = 'jpg|png|gif';
        $config['max_size']    = '200';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';
        $this->upload->initialize($config);
        //do upload screen
        if( ! $this->upload->do_upload('screen'))
        {
            echo('Screen error :' . $this->upload->display_errors() . '---<br>');
        }
        print_r( $this->upload->data());
        echo '<hr>';
        // Set upload rules for source
        $config['upload_path'] = '../files/shop/source/';
        $config['allowed_types'] = 'zip|rar|cdr|psd|ai';
        $config['max_size']    = '24000';
        $this->upload->initialize($config);
        //do upload source
        if ( ! $this->upload->do_upload('source'))
        {
            die('Source error :' . $this->upload->display_errors());
        }
        print_r( $this->upload->data());
    }




Theme © iAndrew 2016 - Forum software by © MyBB