0

I am using codeigniter and uploadify. I am not using the built in uploadify.php, instead I am using my own function in my controller which I feel more suit with my application workflow. I have install uploadify and test it with it's built in .php file. it works good. But when I tried to use my own script, It couldn't upload the file. The error said :

A PHP Error was encountered

Severity: Warning

Message: Illegal offset type in isset or empty

Filename: libraries/Upload.php

Line Number: 147

You did not select a file to upload.

what is it mean? I am sure I've selected the file... for the clarity of my question, here's my code : The View:

 <?php echo form_open_multipart('profile/do_upload_song');?>
 <input id="uploadifyit" type="file" name="filedata" />
 <a href="javascript:$('#uploadifyit').uploadifyUpload();">Upload Files</a>
 <?php echo form_close(); ?>

The .JS:

$("#uploadifyit").uploadify({
        'uploader'       : 'js/jquery/jquery-plugins/uploadify/uploadify.swf',
        'script'         : 'profile/do_upload_song',
        'cancelImg'      : 'js/jquery/jquery-plugins/uploadify/cancel.png',
        'folder'         : 'media',
        'scriptAccess'  : 'always',
        'displayData'   : 'speed',
        'auto'           : false,
        'multi'          : true,
        'fileDataName'  : 'Filedata',
        'fileExt'     : '*.mp3',
        'method'    : 'post',
        'removeCompleted' : false,
        'onComplete': function(event, queueID, fileObj, reposnse, data) {

            $('#fileinfotarget').append('<p>'+reposnse+'</p>');
        }
        });

The Controller:

function do_upload_song()
    {

        $config['upload_path'] = './media/';
        $config['allowed_types'] = 'mp3';
        $config['max_size']    = '144400';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';

        $this->load->library('upload', $config);

        if ( ! $this->upload->do_upload($_FILES['Filedata']))
        {
            echo $this->upload->display_errors();

        }    
        else
        {
            $data = array('upload_data' => $this->upload->data());

            print_r($data);
        }


    }

What's wrong with my code? Any advice guys? Thanks

0

1 Answer 1

2

Check out on of the old questions:

Getting Uploadify to work with Codeigniter?

Implementing jquery upload plugin 'uploadify' with codeigniter

Please search before you ask.

Sign up to request clarification or add additional context in comments.

1 Comment

yeah dude. The deadline makes me so hurry. thanks for the resources.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.