Summary
In this chapter, we have seen how to upload files to the server; this is not the only way to do it, but is the more extended and flexible approach. Another possible method is to serialize the image into base64 in the browser, then set the output string as an attribute in the model; when ten models are saved, the file encoded in base64 will be part of the payload. The server should decode the string and process the result as a file.
We saw how to decouple the view from the business logic. The view should only process DOM events and trigger business logic level events; then a controller can deal with blob objects instead of low-level DOM nodes. This approach helped us to move upload processing from the view to the model, which is the ideal ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access