At the moment this support is not quite there. Noticed that this was missing the upload, so added this commit that you can try with:
https://github.com/kripken/emscripten/commit/a6cdbcef6e2eb300b916c175f8d0f246dff31f84 You could give that patch a try, starting from this example https://github.com/kripken/emscripten/blob/incoming/tests/fetch/example_async_xhr_to_memory.cpp and changing "GET" to "PUT" and filling in the requestData and requestDataSize fields as shown in this example: https://github.com/kripken/emscripten/blob/incoming/tests/fetch/idb_store.cpp#L22 That might work, but I haven't had time to test it out fully yet. 2017-05-18 16:15 GMT+03:00 STM <[email protected]>: > > On the todo here: > https://kripken.github.io/emscripten-site/docs/api_reference/fetch.html > > It says: > > TODO To Document > > Emscripten_fetch() supports the following operations as well, that need > documenting: > > - Emscripten_fetch can be used to upload files to remote servers via > HTTP PUT > > I can't find any examples of this working, and none of the tests in the > tests/fetch seem to use PUT. Does anyone know if it works, or is it > to-be-implemented? > > > Having a basic example, documentation, or just some hints on how to make > it work would be great. A working example with something like this would > be even better: > > https://gist.github.com/UniIsland/3346170 > > (there are a number of forks of this with authentication and other > tweaks). People have examples of it working with a curl POST command like > this: > curl -X POST -F file=@<path-to-file> http://<host-ip>:8000 > > So I assume that there is probably a simple translation to the fetch API, > but POST is not PUT, so maybe fetch won't support that. > > My use case is I'm mostly interested in uploading/saving a log file that > was created within the emscripten virtual file space to a server. > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
