Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Debug Uploadify?

I don't know how to debug Uploadify. All seems to be working, but there are no actual file uploaded. From browser... Upladify event prints "Done!". Before I used Uploadify, PHP code worked... so I don't know where is the problem.

<input id="file_upload" name="file_upload" type="file" rel="<?php echo $group_id; ?>" />

(without <form>)

In Javascript...

$('#file_upload').uploadify({
    'uploader'       : '/media/js/uploadify/uploadify.swf',
    'script'         : '/bio/community/group_picture/' + $('#file_upload').attr('rel'),
    'cancelImg'      : '/media/img/bio/_blog_delete.png',
    'buttonImg'      : '/media/img/bio/browse_files.png',
    'wmode'          : 'transparent',
    'auto'           : true,
    'width'          : 92,
    'sizeLimit'      : 31457280,       
    'height'         : 26,
    'scriptData'     : {'session' : session_id},
    'onAllComplete'  : function() {  location.reload(); }
});

In PHP:

Controller:

public function action_group_picture($group_id) {

    $model_group = Model::factory('Bio_Community_Group');

    if (!empty($_FILES)) {

        $model_group->add_picture($_FILES['file_upload'], $group_id);

        $this->request->redirect('bio/community/edit_group/' . $group_id);

    }

    exit;

}

Model:

public function add_picture($image, $group_id) {

    $filename = $group_id . '.jpg';
    $location = 'uploads/bio/community/groups/' . $filename;

    $image = Image::factory($image['tmp_name']);

    if ($image->width !== 60 || $image->height !== 60) {

        $image->crop(60, 60);

    }

    $image->save($location);

}

I'm using Kohana, by the way. Any ideas why it doesn't work or how to debug?

like image 512
daGrevis Avatar asked Dec 22 '22 11:12

daGrevis


1 Answers

Try using debug:true.

It shows a box with the script's log:

$(function() {
    $("#file_upload").uploadify({
        'debug'    : true,
        'swf'      : '/uploadify/uploadify.swf',
        'uploader' : '/uploadify/uploadify.php' 
    });
});
like image 185
Riccardo Avatar answered Dec 24 '22 00:12

Riccardo