Answer the question
In order to leave comments, you need to log in
Uploading files in Erlang and Cowboy
While developing a website in Erlang, using the Cowboy server as a basis, I encountered a problem with uploading files.
Unfortunately, I can't find a good article on the Internet on how to properly receive files sent by the client.
I tried to figure it out myself, but I was only able to get the entire POST array, parse it and select a file from the POST parameters (other POST data from the form comes with the file), but it is presented as a list and is truncated because there are too many bytes. That is, the file is truncated.
How to accept files from clients in Erlang and Cowboy?
Answer the question
In order to leave comments, you need to log in
<form method="POST" enctype="multipart/form-data">...
Here is an example of a binary File Upload without any XML, jQuery, Base64, XHR, MIME, miltipart, using only the WebSocket channel. Speed without buffers 22MB / s at 40% CPU utilization, supports resuming when the connection is broken on both sides: N2O Binary File Transfer Protocol . The technology description is here: 5ht.co/ftp.htm The issue price is 100 lines of code, the code does not depend much on N2O and can be transferred to a pure cowboy.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question