0
我正在嘗試將Uploadify v2.1.4與Codeigniter v2.1一起使用。我知道閃存沒有將會話數據發送給代碼控制器返回http 302錯誤而不是上傳腳本的控制器。使用Uploadify與Codeigniter框架
我已經看到了各種各樣的解決方案,但它們都是舊版本的框架,特別是codeigniter。有沒有人找到最近的解決方案來將uploadify與CI集成?我可以通過將上傳腳本放置在CI目錄之外來獲得腳本的工作方式,但我想利用CI功能,因此它對我來說不是一個好的解決方案。
要確認我收到錯誤消息 'HTTP 302' ......即uploadify腳本訪問/禁止A /報告/ uploadify
這是jQuery的
$(document).ready(function() {
$('#file_upload').uploadify({
'uploader' : '/swf/uploadify.swf',
'script' : '/a/reports/uploadify',
'cancelImg' : '/img/cancel.png',
'folder' : '/uploads/originals',
'auto' : true,
'fileExt' : '*.jpg;*.pdf;*.doc',
'fileDesc' : 'jpg, pdf or doc',
'hideButton': false,
'removeCompleted':false
});
任我控制器
class Reports extends MY_Controller
{
public function uploadify()
{
log_message('info','uploadify method being called');
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
log_message('info', 'File Upload: Temp file created '.$tempFile);
log_message('info', 'File Upload: Target path for upload '.$targetPath);
log_message('info', 'File Upload: Target file for upload '.$targetFile);
$fileTypes = str_replace('*.','',$_REQUEST['fileext']);
$fileTypes = str_replace(';','|',$fileTypes);
$typesArray = split('\|',$fileTypes);
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$typesArray))
{
move_uploaded_file($tempFile,$targetFile);
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
}
else
{
log_message('error', 'File Upload: Invalid file type uploaded ['.$fileParts['extension'].']');
echo 'Invalid file type.';
}
}
}
}