NodeJS Jade上传文件

时间:2014-03-15 05:29:31

标签: pug

Folks,以下代码抛出错误:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

玉:

input#fileupload(type='file', name='files[]', data-url='/upload', multiple='multiple')


script.
    $(function () {
        $('#fileupload').fileupload({
            dataType: 'json',
            done: function (e, data) {
                $.each(data.result.files, function (index, file) {
                    $('<p/>').text(file.name).appendTo(document.body);
                });
            }
        });
    });

1 个答案:

答案 0 :(得分:1)

如示例here所述,以及您在上传后说服务器失败的内容。

我认为这与上传后处理图像有关,可能会调整图像大小。

这需要在您的系统上安装ImageMagick才能运行命令$ convert

lib/uploadHandler.js

上找到
imageMagick.resize({
   width: opts.width,
   height: opts.height,
   srcPath: options.uploadDir() + '/' + fileInfo.name,
   dstPath: options.uploadDir() + '/' + version + '/' + dstName,
   customArgs: opts.imageArgs || ['-auto-orient']
}, finish);

所以请做一个,

yum install ImageMagick

用于CentOS,或用于Ubuntu / Debian

apt-get install imagemagick
相关问题