Skip to content

Instantly share code, notes, and snippets.

@blackstuend
Created November 22, 2018 16:16
Show Gist options
  • Save blackstuend/655fe146eb6ca703d4388b4da0573c18 to your computer and use it in GitHub Desktop.
Save blackstuend/655fe146eb6ca703d4388b4da0573c18 to your computer and use it in GitHub Desktop.
Promblem for koa save img to server

Promblem

參考資料:

https://ithelp.ithome.com.tw/articles/10195264

http://zhangwenli.com/blog/2015/12/27/upload-canvas-snapshot-to-nodejs/

https://dotblogs.com.tw/shadow/2012/04/01/71209

        const formData = new FormData()
        formData.append('file', file, 'test.png')

        // send ajax request 
        fetch('/', {
            method: 'POST',
            body: formData
        }).then(res => res.text())
            .then(resText => console.log(resText))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment