요청한 파일의 원시 데이터를 가져올 수 있지만 브라우저에서 파일을 사용자에게 제공 할 수 없습니다. iframe을 사용해야합니까?angularjs와 express.js 사이에서 작동하도록 다운로드 받기
//Client code
download_file: function (path, callback) {
$http.post('/download/client_file', {path:path}).
success(function(data, status, headers, config) {
console.log(data); //this contains the raw data of the res.download
//from the server.
});
}
//server code
res.download(file); // the path is proper
HTTP GET을하면 더 잘 작동합니까? 사용자가 파일에 대한 링크를 클릭하면 일어날 일을 에뮬레이트합니다. –
GET 또는 POST를 사용했는지는 중요하지 않았습니다. 적절한 양식 데이터 객체를 가지고 있지 않았습니다. –