8 Star 16 Fork 6

shouldsimple / node-ueditor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ueditor.js 788 Bytes
一键复制 编辑 原始数据 按行查看 历史
wannianchuan 提交于 2014-01-18 09:16 . new file: ueditor.js
var fs = require('fs');
exports.imgManager = function(req, res) {
var str = '';
var i = 0;
fs.readdir(__dirname + '/public/uploads', function(err, files) {
if (err) throw err;
var total = files.length;
files.forEach(function(file) {
str += file + 'ue_separate_ue';
i++;
// send file name string when all files was processed
if(i === total) {
res.end(str);
}
});
});
};
exports.imgUp = function(req, res) {
var title = req.body.pictitle;
var img = req.files.upfile;
var imgPubPath = '/uploads/' + img.name;
var imgAbsPath = __dirname + '/public' + imgPubPath;
fs.rename(img.path, imgAbsPath, function(err) {
if (err) throw err;
res.json({
'url': imgPubPath,
'title': title,
'original': img.name,
'state': 'SUCCESS'
});
});
}
NodeJS
1
https://gitee.com/wannianchuan/node-ueditor.git
git@gitee.com:wannianchuan/node-ueditor.git
wannianchuan
node-ueditor
node-ueditor
master

搜索帮助