我在joomla2.5 中使用uplodify开发了一个画廊组件
鉴于 my_component 我使用了以下代码
$session = & JFactory::getSession();
$document = &JFactory::getDocument();
$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');
$document->addScript(JURI::root(true).'/administrator/components/com_mycomponent/uplodify/jquery.uploadify-3.1.min.js');
$document->addStyleSheet(JURI::root(true).'/administrator/components/com_mycomponent/uplodify/uploadify.css');
$UploadHeadJs ='
// <![CDATA[
jQuery.noConflict();
jQuery(function() {
console.log("load");
jQuery("#model_upload").uploadify({
"swf" : "'.JURI::root(true).'/administrator/components/com_mycomponent/uplodify/uploadify.swf",
"uploader" : "index.php",
"formData" : {"option" : "com_mycomponent", "controller" : "uploadify","task":"uploadify.upload","'.$session->getName().'" : "'.$session->getId().'","cid":"'.$item->id.'","tmpl":"component"},
"method" : "post",
"cancelImg" : "'.JURI::root(true).'/administrator/components/com_mycomponent/uplodify/uploadify-cancel.png",
"uploadLimit" : 25,
"auto" : true,
"buttonText" : "SELECT MODEL",
"debug" : true,
"fileObjName" : "modelImage",
"fileSizeLimit" : "'.ini_get('upload_max_filesize').'B",
"fileTypeDesc" : "Only 25 pictures allow(.jpeg,.gif)",
"fileTypeExts" : "*.jpeg;*.jpg;*.JPEG;*.JPG;*.GIF;*.gif;*.png;*.PNG",
"multi" : true,
"queueID" : "queue",
"height" : 22,
"onUploadError" : function(file, errorCode, errorMsg, errorString) {
console.log( errorMsg);
},
"onUploadSuccess" : function(file, data, response) {
console.log(response);
}
// Put your options here
});
});
//]]>';
$document->addScriptDeclaration($UploadHeadJs);
在 default.php 中包含以下代码
<input type="file" name="modelUpload" id="model_upload"/>
<div id="upload-queue-s" style="background:#CCCCCC">
<div class="inQueu" id="queue"></div>
<ul class="fileQueu">
</ul>
</div>
Uplodfiy 正在正确加载,现在当我开始向控制器编码并尝试回显某些内容以确认请求的 url 是否正常工作时,它将重定向我 joomla 管理员的登录页面
所以我的问题是为什么它重定向我的登录页面,会话有问题吗?我怎样才能将请求表上传到 joomla 控制器文件?