Reader small image

You're reading from  Full Stack Web Development with Remix

Product typeBook
Published inNov 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781801075299
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Andre Landgraf
Andre Landgraf
author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf

Right arrow

Using multi-part form data in Remix

By default, form data is encoded using the application/x-www-form-urlencoded encoding type. URL-encoded form data appends the form data as key-value pairs to the request URL as search parameters. To attach files to HTML forms, we need to change the form’s encoding type. Appending form data to the URL is not the right approach when transferring binary data such as files. In this section, you will learn how to use multi-part encoding to support file uploads.

There are three different encoding types for HTML form elements:

  • application/x-www-form-urlencoded
  • multipart/form-data
  • text/plain

text/plain is not what we are looking for. Plaintext encoding is not used for client-server communication as it submits the data in a human-readable format. Instead, we want to use multipart/form-data encoding, which places the form data into the request body, making it possible to include and stream binary files.

Let’s update...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Full Stack Web Development with Remix
Published in: Nov 2023Publisher: PacktISBN-13: 9781801075299

Author (1)

author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf