This is mainly done by using the file-like interface of socket objects.
Attach a file by drag & drop or click to upload