Node.js文件到Angular文件上传

问题描述 投票:0回答:0

我试图弄清楚如何将Node.js文件系统连接到角度文件上传指令。

我使用以下命令从Node获取文件:

var file = brackets.test.FileSystem.getFileForPath('/Users/me/Desktop/new-year-2015.jpg')

结果对象看起来像:

File {_isFile: true, _name: "new-year-2015.jpg", _parentPath: "/Users/me/Desktop/", _path: "/Users/me/Desktop/new-year-2015.jpg", _fileSystem: FileSystem…}_fileSystem: FileSystem_id: 89_impl: (...)_isFile: true_name: "new-year-2015.jpg"_parentPath: "/Users/me/Desktop/"_path: "/Users/me/Desktop/new-year-2015.jpg"

我正在尝试使用以下方法将该对象上传到服务器:

$upload.upload({
                    url: 'https://localhost/upload',
                    file: file,
                    fileName: getFilenameFromPath(file),
                   });

在服务器上,该文件被接收为空。

如何在角度文件上传中使用node.js文件对象?

javascript angularjs node.js
© www.soinside.com 2019 - 2024. All rights reserved.