| 323 | stopFile () { return (this.instance != null ? this.instance.stop() : undefined) } |
| 324 | |
| 325 | onFileChosen (InkBlob) { |
| 326 | if (!this.settings.filePath) { |
| 327 | console.error('Need to specify a filePath for this treema', this.getRoot()) |
| 328 | throw Error('cannot upload file') |
| 329 | } |
| 330 | |
| 331 | const body = { |
| 332 | url: InkBlob.url, |
| 333 | filename: InkBlob.filename, |
| 334 | mimetype: InkBlob.mimetype, |
| 335 | path: this.settings.filePath, |
| 336 | force: true, |
| 337 | } |
| 338 | |
| 339 | this.uploadingPath = [this.settings.filePath, InkBlob.filename].join('/') |
| 340 | return $.ajax('/file', { type: 'POST', data: body, success: this.onFileUploaded, error: uploadFailHandler }) |
| 341 | } |
| 342 | |
| 343 | onFileUploaded (e) { |
| 344 | this.data = this.uploadingPath |