I have a .txt file that contains a paragraph, and I want to pass it from my Angular Controller (I have it already: uploaded it via a form) as a parameter to http.get and read it in the Controller. Any Idea?
Asked
Active
Viewed 357 times
0
-
1Check this link :- http://stackoverflow.com/questions/31598135/how-to-read-a-text-file-and-display-it-in-html-angularjs – Ravi Hirani Jun 15 '16 at 12:38
2 Answers
0
you can use 1. https://github.com/leon/angular-upload 2. https://github.com/danialfarid/ng-file-upload 3. https://github.com/uor/angular-file 4. https://github.com/twilson63/ngUpload 5. https://github.com/uploadcare/angular-uploadcare

ayoub laaziz
- 1,196
- 9
- 12
-
My problem is between the call (Angular side) and the catch (REST endpoint) side, I already uploaded the file in my angular application. – Chayma Atallah Jun 15 '16 at 12:51
0
var fs = require('fs');
var restler = require('restler');
var url = 'https://api.xxxxxxx';
var headers = {
"Access-Token": "3xxxxxxxxxxx",
};
fs.stat("/path/file.pdf", function(err, stats) {
restler.post(url, {
multipart: true,
headers: headers,
data: {
"File": restler.file("/path/file.pdf", null, stats.size, null, "application/pdf")
}
}).on("complete", function(data) {
console.log(data);
});
});

ayoub laaziz
- 1,196
- 9
- 12