我正在使用 yii 框架,我正在尝试实现一个 CKEditor。一切都很好,直到我需要制作文件上传/浏览功能,我管理上传但浏览......为此我找到了本指南(它使用扩展 elfinder) http://www.yiiframework.com/extension /ezzeelfinder/
问题是当我点击浏览文件 - > http://img835.imageshack.us/img835/5905/problems.png 并且页面错误来自 /TutProject/index.php/page/page/fileUploaderConnector ,这里是stackTrace/应用程序日志中的内容
include(finfo.php) [<a href='function.include'>function.include</a>]:
failed to open stream: No such file or directory
(C:\wamp\www\yii-1.1.10.r3566\framework\YiiBase.php:418)
Stack trace:
#0 unknown(0): spl_autoload_call()
#1
C:\wamp\www\TutProject\protected\extensions\ezzeelfinder\php\elFinderVolumeDriver.class.php(644):
class_exists()
#2
C:\wamp\www\TutProject\protected\extensions\ezzeelfinder\php\elFinder.class.php(191):
elFinderVolumeLocalFileSystem->mount()
#3
C:\wamp\www\TutProject\protected\extensions\ezzeelfinder\ElFinderConnectorAction.php(54):
elFinder->__construct()
#4 C:\wamp\www\yii-1.1.10.r3566\framework\web\actions\CAction.php(75):
ElFinderConnectorAction->run()
#5 C:\wamp\www\yii-1.1.10.r3566\framework\web\CController.php(309):
ElFinderConnectorAction->runWithParams()
#6 C:\wamp\www\yii-1.1.10.r3566\framework\web\CController.php(287):
PageController->runAction()
#7 C:\wamp\www\yii-1.1.10.r3566\framework\web\CController.php(266):
PageController->runActionWithFilters()
#8 C:\wamp\www\yii-1.1.10.r3566\framework\web\CWebApplication.php(276):
PageController->run()
#9 C:\wamp\www\yii-1.1.10.r3566\framework\web\CWebApplication.php(135):
CWebApplication->runController()
#10 C:\wamp\www\yii-1.1.10.r3566\framework\base\CApplication.php(162):
CWebApplication->processRequest()
#11 C:\wamp\www\TutProject\index.php(13): CWebApplication->run()
REQUEST_URI=/TutProject/index.php/page/page/fileUploaderConnector?elfinder_connector_options/YToxOntzOjU6InJvb3RzIjthOjE6e2k6MDthOjY6e3M6NjoiZHJpdmVyIjtzOjE1OiJMb2NhbEZpbGVTeXN0ZW0iO3M6NDoicGF0aCI7czoyOToiQzpcd2FtcFx3d3dcVHV0UHJvamVjdFx1cGxvYWQiO3M6MzoiVVJMIjtzOjE4OiIvVHV0UHJvamVjdC91cGxvYWQiO3M6NzoidG1iUGF0aCI7czozNzoiQzpcd2FtcFx3d3dcVHV0UHJvamVjdFx1cGxvYWRcLnRodW1icyI7czoxMDoibWltZURldGVjdCI7czo4OiJpbnRlcm5hbCI7czoxMzoiYWNjZXNzQ29udHJvbCI7czo2OiJhY2Nlc3MiO319fQ%3D%3D?cmd=open&target=&init=1&tree=1&_=1337086423129
我尝试在我的框架文件夹中搜索这个 finfo.php,但我没有找到它。我的 php 版本是 5.3.10 (我发现它是 5.3 之前的扩展)而且从我用谷歌搜索的内容来看,似乎另一个人和我有同样的问题,这是他不得不说的
“好吧,我发现了我的问题。显然 elfinder 试图自动确定 mime 类型的位置。我将其更改为手动引用文件,一切都很好。感谢出色的扩展!”
但我还是 Yii 的新手,所以我不知道该怎么做,任何帮助将不胜感激。如果您需要有关任何内容的更多信息,请发表评论。
编辑:哦,顺便说一句,我的截图中的错误,它说“无法连接到后端”
EDIT-2:这是我使用的小部件。
$this->widget("ext.ezzeelfinder.ElFinderWidget", array(
'selector' => "div#file-uploader",
'clientOptions' => array(
// 'lang' => "bg",
'resizable' => false,
'wysiwyg' => "ckeditor"
),
'connectorRoute' => "/page/page/fileUploaderConnector",
'connectorOptions' => array(
'roots' => array(
array(
'driver' => "LocalFileSystem",
'path' => 'C:\wamp\www\TutProject\upload',
'URL' => 'http://localhost/TutProject/upload/',
'tmbPath' => $filesPath . DIRECTORY_SEPARATOR . ".thumbs",
'mimeDetect' => "internal",
'accessControl' => "access"
)
)
)
));
在这里 -> 'connectorRoute' => "/page/page/fileUploaderConnector",
第一个 "/page" 是我在 Yii 中使用的模块,第二个 "/page" 是控制器
我注意到一件奇怪的事情,我认为我的问题来自那里,让我解释一下,我将显示两个链接,第一个将由
'connectorRoute' => "/page/page/fileUploaderConnector",
第二个将由
'connectorRoute' => "/page/fileUploaderConnector",
现在,我不确定它是否是一个错误,但是,看看下面的链接
http://localhost/TutProject/index.php/page/page/fileUploaderConnector/elfinder_connector_options/YToxOntzOjU6InJvb3RzIjthOjE6e2k6MDthOjY6e3M6NjoiZHJpdmVyIjtzOjE1OiJMb2NhbEZpbGVTeXN0ZW0iO3M6NDoicGF0aCI7czoyOToiQzpcd2FtcFx3d3dcVHV0UHJvamVjdFx1cGxvYWQiO3M6MzoiVVJMIjtzOjM1OiJodHRwOi8vbG9jYWxob3N0L1R1dFByb2plY3QvdXBsb2FkLyI7czo3OiJ0bWJQYXRoIjtzOjM3OiJDOlx3YW1wXHd3d1xUdXRQcm9qZWN0XHVwbG9hZFwudGh1bWJzIjtzOjEwOiJtaW1lRGV0ZWN0IjtzOjg6ImludGVybmFsIjtzOjEzOiJhY2Nlc3NDb250cm9sIjtzOjY6ImFjY2VzcyI7fX19?cmd=open&target=&init=1&tree=1&_=1337106505830
http://localhost/TutProject/index.php/page/fileUploaderConnector?elfinder_connector_options=YToxOntzOjU6InJvb3RzIjthOjE6e2k6MDthOjY6e3M6NjoiZHJpdmVyIjtzOjE1OiJMb2NhbEZpbGVTeXN0ZW0iO3M6NDoicGF0aCI7czoyOToiQzpcd2FtcFx3d3dcVHV0UHJvamVjdFx1cGxvYWQiO3M6MzoiVVJMIjtzOjM1OiJodHRwOi8vbG9jYWxob3N0L1R1dFByb2plY3QvdXBsb2FkLyI7czo3OiJ0bWJQYXRoIjtzOjM3OiJDOlx3YW1wXHd3d1xUdXRQcm9qZWN0XHVwbG9hZFwudGh1bWJzIjtzOjEwOiJtaW1lRGV0ZWN0IjtzOjg6ImludGVybmFsIjtzOjEzOiJhY2Nlc3NDb250cm9sIjtzOjY6ImFjY2VzcyI7fX19&cmd=open&target=&init=1&tree=1&_=1337106612468
在这些链接中要注意的是,在第一个链接(即使用 /page/page/... 的那个)中,fileUploaderConnector 之后的下一个符号是 '/',然后在 elfinder_connector_options 之后,又有一个 '/',但是在 fileUploaderConnector 之后的第二个链接(来自 /page/... 的那个)中,下一个符号是“?” 在 elfinder_connector_options 之后有一个 '='
现在我认为,当路径包含 MODULE 时,链接会变得混乱,所以我试图修复它,实际上我设法获得(至少我认为如此)一个有效的链接,
这是我认为有效并生成输出的链接
http://localhost/TutProject/index.php/page/page/fileUploaderConnector?elfinder_connector_options=YToxOntzOjU6InJvb3RzIjthOjE6e2k6MDthOjY6e3M6NjoiZHJpdmVyIjtzOjE1OiJMb2NhbEZpbGVTeXN0ZW0iO3M6NDoicGF0aCI7czoyOToiQzpcd2FtcFx3d3dcVHV0UHJvamVjdFx1cGxvYWQiO3M6MzoiVVJMIjtzOjM1OiJodHRwOi8vbG9jYWxob3N0L1R1dFByb2plY3QvdXBsb2FkLyI7czo3OiJ0bWJQYXRoIjtzOjM3OiJDOlx3YW1wXHd3d1xUdXRQcm9qZWN0XHVwbG9hZFwudGh1bWJzIjtzOjEwOiJtaW1lRGV0ZWN0IjtzOjg6ImludGVybmFsIjtzOjEzOiJhY2Nlc3NDb250cm9sIjtzOjY6ImFjY2VzcyI7fX19&cmd=open&target=&init=1&tree=1&_=1337106612468
它与第二个链接相同,我只是在链接中添加了另一个“/page”,所以这是输出
{"cwd":{"mime":"directory","ts":1337085846,"read":1,"write":1,"size":0,"hash":"l1_XA","volumeid": "l1_","name":"upload","date":"今天 12:44","locked":1,"dirs":1},"options":{"path":"upload"," url":"http://localhost/TutProject/upload/","tmbUrl":"http://localhost/TutProject/upload/.thumbs/","disabled":[],"separator":"\" ,"copyOverwrite":1,"archivers":{"create":[],"extract":[]}},"files":[{"mime":"directory","ts":1337085846,"read ":1,"write":1,"size":0,"hash":"l1_XA","volumeid":"l1_","name":"upload","date":"今天 12:44","locked":1,"dirs":1},{"mime":"目录","ts":1337085846,"read":1,"write":1,"size":0,"hash":"l1_LnRodW1icw","name":".thumbs","phash":"l1_XA" ,"date":"今天 12:44"},{"mime":"image/png","ts":1319019671,"read":1,"write":1,"size":142959,"hash ":"l1_MWJpbC5wbmc","name":"1bil.png","phash":"l1_XA","date":"19 Oct 2011 10:21","tmb":1}],"api":" 2.0","uplMaxSize":"2M"}"l1_","name":"upload","date":"今天 12:44","locked":1,"dirs":1},{"mime":"directory","ts":1337085846 ,"read":1,"write":1,"size":0,"hash":"l1_LnRodW1icw","name":".thumbs","phash":"l1_XA","date":"今天12:44"},{"mime":"image/png","ts":1319019671,"read":1,"write":1,"size":142959,"hash":"l1_MWJpbC5wbmc","名称":"1bil.png","phash":"l1_XA","date":"2011 年 10 月 19 日 10:21","tmb":1}],"api":"2.0","uplMaxSize": “2M”}"l1_","name":"upload","date":"今天 12:44","locked":1,"dirs":1},{"mime":"directory","ts":1337085846 ,"read":1,"write":1,"size":0,"hash":"l1_LnRodW1icw","name":".thumbs","phash":"l1_XA","date":"今天12:44"},{"mime":"image/png","ts":1319019671,"read":1,"write":1,"size":142959,"hash":"l1_MWJpbC5wbmc","名称":"1bil.png","phash":"l1_XA","date":"2011 年 10 月 19 日 10:21","tmb":1}],"api":"2.0","uplMaxSize": “2M”}date":"今天 12:44","locked":1,"dirs":1},{"mime":"directory","ts":1337085846,"read":1,"write":1, "size":0,"hash":"l1_LnRodW1icw","name":".thumbs","phash":"l1_XA","date":"今天 12:44"},{"mime":"image /png","ts":1319019671,"read":1,"write":1,"size":142959,"hash":"l1_MWJpbC5wbmc","name":"1bil.png","phash": "l1_XA","date":"2011 年 10 月 19 日 10:21","tmb":1}],"api":"2.0","uplMaxSize":"2M"}date":"今天 12:44","locked":1,"dirs":1},{"mime":"directory","ts":1337085846,"read":1,"write":1, "size":0,"hash":"l1_LnRodW1icw","name":".thumbs","phash":"l1_XA","date":"今天 12:44"},{"mime":"image /png","ts":1319019671,"read":1,"write":1,"size":142959,"hash":"l1_MWJpbC5wbmc","name":"1bil.png","phash": "l1_XA","date":"2011 年 10 月 19 日 10:21","tmb":1}],"api":"2.0","uplMaxSize":"2M"}ts":1337085846,"read":1,"write":1,"size":0,"hash":"l1_LnRodW1icw","name":".thumbs","phash":"l1_XA","date ":"今天 12:44"},{"mime":"image/png","ts":1319019671,"read":1,"write":1,"size":142959,"hash":" l1_MWJpbC5wbmc","name":"1bil.png","phash":"l1_XA","date":"2011 年 10 月 19 日 10:21","tmb":1}],"api":"2.0", "uplMaxSize":"2M"}ts":1337085846,"read":1,"write":1,"size":0,"hash":"l1_LnRodW1icw","name":".thumbs","phash":"l1_XA","date ":"今天 12:44"},{"mime":"image/png","ts":1319019671,"read":1,"write":1,"size":142959,"hash":" l1_MWJpbC5wbmc","name":"1bil.png","phash":"l1_XA","date":"2011 年 10 月 19 日 10:21","tmb":1}],"api":"2.0", "uplMaxSize":"2M"}{"mime":"image/png","ts":1319019671,"read":1,"write":1,"size":142959,"hash":"l1_MWJpbC5wbmc","name":"1bil. png","phash":"l1_XA","date":"19 Oct 2011 10:21","tmb":1}],"api":"2.0","uplMaxSize":"2M"}{"mime":"image/png","ts":1319019671,"read":1,"write":1,"size":142959,"hash":"l1_MWJpbC5wbmc","name":"1bil. png","phash":"l1_XA","date":"19 Oct 2011 10:21","tmb":1}],"api":"2.0","uplMaxSize":"2M"}
我没有将它作为代码示例发布,因为它很长。
所以在这里我想出了一个次要问题,因为我认为我的链接以某种方式被修改了,知道如何让它停止吗?它为“/”更改了“?,=”。