Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class MyComp {
- function save() {
- let data : ArrayBuffer = this.readFile(this.file);
- this.imageService.upload(data);
- }
- }
- @Injectable()
- export class ImageService {
- private http: Http;
- constructor(@Inject()http: Http) {
- this.http = http;
- }
- upload(image: ArrayBuffer) {
- let headers = new Headers({ 'Content-Type': 'image/png' });
- //let arr = new Int16Array(image);
- //let body = String.fromCharCode.apply(null, arr);
- return this.http
- .put('/upload', body, { headers: headers })
- .map(response => response.json());
- }
- export class Request {
- // TODO: support URLSearchParams | FormData | Blob | ArrayBuffer
- }
- export class Response {
- // TODO: Support ArrayBuffer, JSON, FormData, Blob
- }
Add Comment
Please, Sign In to add comment