dwz xheditor编辑器文件上传
来源:互联网 发布:淘宝网首页登录电脑版 编辑:程序博客网 时间:2024/05/28 14:56
转载地址:http://blog.csdn.net/sean_cd/article/details/8027315
client------------------------ <form method="post" action="/Articles/articleEdit" class="pageForm required-validate" enctype="multipart/form-data" onsubmit="return iframeCallback(this, dialogAjaxDone)" > <textarea name="fld_content" rows="23" cols="83" class="editor" tools="Fullscreen,Source,Preview,Print,|,SelectAll,Cut,Copy,Paste,Pastetext,Blocktag,|,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,|,Removeformat Align,List,Outdent,Indent,Link,Unlink,Anchor,Img,Hr,Table" skin="default" upLinkUrl="" upLinkExt="zip,rar,txt,doc,docx" upImgUrl="/FileUpload/doXheditorUpload?flag=img" upImgExt="jpg,jpeg,gif,png" upMultiple=6 upFlashUrl="" upFlashExt="swf">{$info.fld_content} </textarea> server----------------------------- public function action_doXheditorUpload() { global $CONFIG; $cdnServer = $CONFIG['CDNServer']; $cdnServerInfo = $cdnServer['IC']; //generator saved file name $ymd = date("Ymd"); $cdnFilePath = "ic/images/".$ymd; if (empty($_FILES) === false) { $fileName = $_FILES['filedata']['name']; $tmp_name = $_FILES['filedata']['tmp_name']; $cdnFileName = $this->generateFileNameByTime($fileName); if(AdminLib_CDNUploadUtility::moveFileToCdn($tmp_name, $cdnFilePath, $cdnFileName, $cdnServerInfo, $imgUrl)){ header('Content-type: text/html; charset=UTF-8'); exit(json_encode(array('err' => 0, 'msg' => $imgUrl))); } } } static public function moveFileToCdn($sLocalFile, $sCDNFilePath, $sCDNFileName, $cdn_server_info, & $sCDNFileFullUrl) { $ret = false; try { $local_filefullname = $sLocalFile; //resolveUrl($sFileDir) . $sFileName; $fp = @fopen($local_filefullname , 'r'); if(!$fp) { fb("no local: $local_filefullname", FirePHP::TRACE); return false; } if(!is_array($sCDNFilePath)) $sCDNFilePath = explode ("/", $sCDNFilePath); $conn_id = @ftp_connect($cdn_server_info['ftp_host'], $cdn_server_info['ftp_port'], 15); if($conn_id) { $ret = @ftp_login($conn_id, $cdn_server_info['ftp_username'], $cdn_server_info['ftp_password']); if($ret) { @ftp_pasv($conn_id, true); if(isset($cdn_server_info['ftp_path'])) { $path = trim($cdn_server_info['ftp_path']); $path = rtrim($path, '/'); try { //there is a WARNING to EXCEPTION handler in system .... $ret = @ftp_chdir($conn_id, $path); }catch(Exception $ex){} } foreach($sCDNFilePath as $dirname) { if($ret) { $chdir_ok = false; try { //there is a WARNING to EXCEPTION handler in system .... $chdir_ok = @ftp_chdir($conn_id, $dirname); }catch(Exception $ex){} if( ! $chdir_ok ) { $ret = $ret && (ftp_mkdir($conn_id, "$dirname") !== false); $ret = $ret && ftp_chdir($conn_id, "$dirname"); } } } $ret = $ret && @ftp_fput($conn_id, $sCDNFileName, $fp, FTP_BINARY); if ($ret) { $sCDNFileFullUrl = $cdn_server_info['http_base_url'] . join("/", $sCDNFilePath) . "/" . $sCDNFileName; } } @ftp_close($conn_id); } @fclose($fp); }catch(Exception $ex){ monolog_info('Thumb/koubei', "Move CDN failed,{$sLocalFile}.\r\n"); } return $ret; }
0 0
- dwz xheditor编辑器文件上传
- dwz xheditor编辑器文件上传
- ThinkPHP+DWZ(xhEditor)上传图片
- xheditor struts2 上传文件
- xheditor编辑器上传功能实现
- dwz+nutz+xheditor 论坛输入框上传图片
- dwz 上传文件问题
- dwz多文件上传
- struts2中添加xheditor编辑器,上传图片
- xheditor编辑器
- xheditor编辑器
- dwz框架做文件上传
- DWZ文件上传,time转化
- xheditor-文件上传-java-支…
- xheditor-文件上传-java-支…
- Java 实现 xhEditor 文件上传处理
- 编辑器xheditor图片上传配置如何设置的问题
- Laravel5.2中使用xheditor编辑器实现上传图片功能
- HDFS详解
- 有向图的C++实现
- hdu 2159 FATE(二维完全背包)
- 常用正则表达式
- shell 中函数返回值的接收
- dwz xheditor编辑器文件上传
- InnoDB行锁、事务还有死锁
- 内存泄漏排查
- 386. Lexicographical Numbers
- C#中的listview选中整行是什么属性?
- php重定向的三种方法
- java内存分配
- anti-Nim题目标准代码
- struts2值栈与action上下文