Y
Y
yokes2014-05-18 20:07:35
Erlang
yokes, 2014-05-18 20:07:35

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

2 answer(s)
S
sim3x, 2014-05-18
@yokes

<form method="POST" enctype="multipart/form-data">...

+
https://github.com/extend/cowboy/blob/master/guide...

M
Maxim Sokhatsky, 2015-09-23
@5HT

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 question

Ask a Question

731 491 924 answers to any question