MCPcopy Create free account
hub / github.com/codecombat/codecombat / onFileChosen

Method onFileChosen

app/core/treema-ext.js:325–341  ·  view source on GitHub ↗
(InkBlob)

Source from the content-addressed store, hash-verified

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

Callers 1

onFileChosenMethod · 0.45

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected