[eluser]Unknown[/eluser]
I am using uploadify with codeigniter and when uploading, I keep getting "File type is not allowed". Upon error I am printing the files current type, and everything I upload is showing "oectet-stream".
views/upload.php
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<link href="<?php echo base_url() ?>assets/uploadify/uploadify.css" type="text/css" rel="stylesheet">
[removed][removed]
[removed][removed]
[removed][removed]
[removed]
$(document).ready(function() {
$('#file_upload').uploadify({
'uploader' : '<?php echo base_url() ?>assets/uploadify/uploadify.swf',
'script' : '<?php echo site_url('upload/do_upload') ?>',
'cancelImg' : '<?php echo base_url() ?>assets/uploadify/cancel.png',
'auto' : true,
'fileDataName' : 'userfile',
'onComplete' : function(a, b, c, d, e){
if (d !== '1') {alert(d);}
else { alert('Filename: ' + c.name + ' was uploaded');}
}
});
});
[removed]
</head>
<body>
<input id="file_upload" name="file_upload" type="file">
</body>
</html>
controllers/upload.php
Code:
<?php
class Upload extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('url');
}
public function index() {
$this->load->view('upload');
}
public function do_upload() {
$config['upload_path'] = '/tmp/';
$config['max_size'] = '10000';
$config['allowed_types'] = 'zip';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if(!$this->upload->do_upload()) {
//echo $this->upload->display_errors();
echo $_FILES['userfile']['type'];
} else {
echo 'Uploaded';
}
}
}
Any idea why it's doing this? I've tried allowing jpg, png, txt etc but it's still the same.