我正在使用codeigniter和uploadify。我没有使用内置的uploadify.php,而是在我的控制器中使用我自己的功能,我感觉更适合我的应用程序工作流程。我已安装uploadify并使用内置的.php文件对其进行测试。它运作良好。但是当我尝试使用自己的脚本时,它无法上传文件。错误说:
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.
是什么意思?我相信我已经选择了这个文件...... 为了清楚我的问题,这是我的代码: 观点:
<?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(); ?>
.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>');
}
});
控制器:
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);
}
}
我的代码出了什么问题?有什么建议吗?感谢
答案 0 :(得分:2)