Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
DSHa 04.11.2009 01:36
использую коннектор Parser@auto[] # каталог куда фск сможет что либо закачивать $userFiles[/userfiles] $filePermission[ $.Image[ $.AllowedExtensions[jpg|gif|jpeg|png] $.DeniedExtensions[] ] $.File[ $.AllowedExtensions[] $.DeniedExtensions[phtml|php|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg] ] $.Flash[ $.AllowedExtensions[swf|fla] $.DeniedExtensions[] ] $.Media[ $.AllowedExtensions[swf|fla|jpg|gif|jpeg|png|avi|mpg|mpeg] $.DeniedExtensions[] ] ] $resourcePath[ $.Image[img] $.File[file] $.Flash[flash] $.Media[] ] #################################3 @main[] ^connect[$CONNECT_STRING]{ ^fileManager[] } ####################### @fileManager[] $now[^date::now[]] $resourceType[$form:Type] $command[$form:Command] $currentFolder[$form:CurrentFolder] #$currentFolder[^currentFolder.trim[both;\/]] $rp[$resourcePath.$resourceType] $path[${userFiles}/${rp}$currentFolder] $fileExt[$filePermission.[$resourceType].AllowedExtensions] $deny[$filePermission.[$resourceType].DeniedExtensions] ^switch[$command]{ ^case[GetFoldersAndFiles]{$xml[^getFoldersAndFiles[]]} ^case[CreateFolder]{$xml[^createFolder[$form:NewFolderName]]} ^case[GetFolders]{$xml[^getFolders[]]} ^case[FileUpload]{$xml[^fileUpload[]]} ^case[DEFAULT]{$xml[^getFoldersAndFiles[]]} } $response:Expires[ Mon, 26 Jul 1997 05:00:00 GMT] $response:Last-Modified[^now.unix-timestamp[]] $response:Cache-Control[no-store, no-cache, must-revalidate,post-check=0, pre-check=0] ^if($command ne "FileUpload"){$response:Content-Type[text/xml^; charset=windows-1251]} $response:Pragma[no-cache] $response:body[$xml] $result[] @fileUpload[] $error[0] ^form:fields.foreach[field;value]{ ^if(^field.pos[NewFile]>=0){ $name[$value.name] ^try{ ^if(^name.match[^^.*\.($deny)^$] || (!^name.match[^^.*\.($fileExt)^$])){ #неверное расширение файла $error[202] }{ ^value.save[binary;${path}$value.name] } }{ $error[1000] $exception.handled(1) } } } $result[ <script type="text/javascript"> window.parent.frames["frmUpload"].OnUploadCompleted($error, '$name')^; </script>] @listFiles[] ### Выводит список файлов в формате xml $list[^file:list[$path;\.($fileExt)^$]] ^if(def $list){ $result[<Files> ^list.menu{$f[^file::stat[$path/$list.name]]$sz(^math:round($f.size/1024)) ^if($sz==0){$sz(1)} <File name="$list.name" size="$sz"/>} </Files>] }{ $result[<Files/>] } @listFolders[] ### Выводит список каталогов в формате xml $list[^file:list[$path]] ^if(def $list){ $result[<Folders> ^list.menu{^if(-d "$path/$list.name"){<Folder name="$list.name"/> }} </Folders> ] }{ $result[<Folders/>] } @getFoldersAndFiles[] $folders[^listFolders[]] $files[^listFiles[]] $result[^createXmlHeader[] $folders $files ^createXmlFooter[]] @getFolders[] $folders[^listFolders[]] $result[^createXmlHeader[] $folders ^createXmlFooter[]] @createXmlHeader[] $result[<?xml version="1.0" encoding="utf-8" ?> <Connector command="$command" resourceType="$resourceType" > <CurrentFolder path="$currentFolder" url="$path" /> ] @createXmlFooter[] $result[</Connector>] @createFolder[newFolder] $f[ ] $error[<Error number="0" originalDescription="No Error" />] ^try{ ^f.save[${path}${newFolder}/tmp.tmp] }{ $exception.handled(1) $error[<Error number="500" originalDescription="$exception.comment ${path}${newFolder}/tmp.tmp" />] } ^if(def $error){ $body[$error] }{ $body[^getFolders[]] } $result[^createXmlHeader[] $body ^createXmlFooter[]]В fckconfig.js настройки следующие
FCKConfig.LinkBrowser = true ; FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.htm?Connector=connectors/parser/connector.html'; //FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ; FCKConfig.LinkBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% FCKConfig.LinkBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% FCKConfig.ImageBrowser = true ; FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ; FCKConfig.ImageBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% ; FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% ; FCKConfig.FlashBrowser = true ; FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ; FCKConfig.FlashBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; //70% ; FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; //70% ; FCKConfig.LinkUpload = true ; FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/browser/' + FCKConfig.QuickUploadLanguage + '/defaul.' + _QuickUploadLanguage ; FCKConfig.LinkUploadAllowedExtensions = "" ; // empty for all FCKConfig.LinkUploadDeniedExtensions = ".(php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi)$" ; // empty for no one FCKConfig.ImageUpload = true ; FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/browser/' + FCKConfig.QuickUploadLanguage + '/defaul.' + _QuickUploadLanguage + '?Type=Image' ; FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png)$" ; // empty for all FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one FCKConfig.FlashUpload = true ; FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/browser/' + FCKConfig.QuickUploadLanguage + '/defaul.' + _QuickUploadLanguage + '?Type=Flash' ; FCKConfig.FlashUploadAllowedExtensions = ".(swf|fla)$" ; // empty for all FCKConfig.FlashUploadDeniedExtensions = "" ; // empty for no oneПри обращении к загрузке выскакивает ошибка XML request error: Internal Server Error (500)