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?
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'
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With