2012-01-24 70 views
0

我正在使用codeigniter和uploadify。我沒有使用內置的uploadify.php,而是在我的控制器中使用我自己的功能,我覺得它更符合我的應用程序工作流程。我已經安裝uploadify並使用它內置的.php文件進行測試。它運作良好。但是當我嘗試使用我自己的腳本時,它無法上傳文件。錯誤說:無法使用uploadify和codeigniter上傳文件

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); 
     } 


    } 

我的代碼有什麼問題?任何建議傢伙?在老問題,由於

回答