没有上传Express Image的Node.js

时间:2013-08-17 08:53:20

标签: node.js express

我正在使用express工作Node.js,我正在尝试上传图片

if(req.files.awatar.size > 0) {
        var tmp_path = req.files.awatar.path;
        var upload_path = USER_IMAGES+req.files.awatar.name;

        fs.readFile(tmp_path, function(err, data) {

            fs.writeFile(upload_path, data, function(err){
                if(!err) awatar = req.files.awatar.name;
            });

            fs.unlink(tmp_path, function(){
                if(err) throw err;
            })

        } );
    }

但图片没有上传,我在控制台上收到消息

.write(string, encoding, offset, length) is deprecated. Use write(string, offset, length, encoding) instead.

0 个答案:

没有答案