Search code examples
phpcodeigniteruploadify

CodeIgniter with Uploadify


I really dont know what I'm missing, I integrated Uploadify with my CodeIgniter based site and it's not working.

When I chose multiple images, some of them are say it's complete, and some of them give an IO Error, and the images never get uploaded to the folder

$('#file_upload').uploadify({
    'uploader'       : '<?php echo base_url(); ?>uploadify/uploadify.swf',
    'script'         : '<?php echo base_url(); ?>ihirdet/feltoltes',
    'cancelImg'      : '<?php echo base_url(); ?>uploadify/cancel.png',
    'folder'         : '<?php echo base_url(); ?>uploads/',
    'fileExt'        : '*.jpg;*.gif;*.png',
    'displayData'    : 'speed',
    'wmode'          : 'transparent',
    'simUploadLimit' : 5,
    'multi'          : true
});

and my controller

function feltoltes() {

    if ( ! empty($_FILES)) {
        $tempFile = $_FILES['file_input']['tmp_name'];
        $targetPath = $_SERVER['DOCUMENT_ROOT'] . '/SVN/handinhand/assets/images/galleries';
        $targetFile =  str_replace('//','/',$targetPath) . $_FILES['file_input']['name'];
        move_uploaded_file($tempFile,$targetFile);    
    }

    echo '1';
}

Does anybody see some error in these codes? Or just give me a hint?

Thank you


Solution

  • This is strange... A click on a Similar Questions link next to your question led me to Getting Uploadify to work with Codeigniter? which led me to http://codeigniter.com/forums/viewthread/109751/ which is almost an exact duplicate of your question here... Paths and everything...

    Anyway, did you try the solution in that CI thread? Are you allowing access to your uploadify scripts via .htaccess?

    RewriteEngine on
    RewriteCond $1 !^(index\.php|(.*)\.swf|uploadify|application|system|assets|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]