diff --git a/5-network/02-formdata/article.md b/5-network/02-formdata/article.md index 1c28296d2..75b0a98f8 100644 --- a/5-network/02-formdata/article.md +++ b/5-network/02-formdata/article.md @@ -1,26 +1,26 @@ # FormData -This chapter is about sending HTML forms: with or without files, with additional fields and so on. +Ce chapitre concerne l'envoi de formulaires HTML: avec ou sans fichiers, avec des champs supplémentaires, etc... -[FormData](https://xhr.spec.whatwg.org/#interface-formdata) objects can help with that. As you might have guessed, it's the object to represent HTML form data. +Les objets [FormData](https://xhr.spec.whatwg.org/#interface-formdata) peuvent nous aider pour cela. Comme vous l'avez peut-être deviné, c'est l'objet pour représenter les données du formulaire HTML. -The constructor is: +Le constructeur est : ```js let formData = new FormData([form]); ``` -If HTML `form` element is provided, it automatically captures its fields. +Si un élément HTML `form` est fourni, il capture automatiquement ses champs. -The special thing about `FormData` is that network methods, such as `fetch`, can accept a `FormData` object as a body. It's encoded and sent out with `Content-Type: form/multipart`. +La particularité de `FormData` est que les méthodes réseau, telles que `fetch`, peuvent accepter un objet `FormData` en tant que corps. Il est encodé et envoyé avec `Content-Type: form/multipart`. -From the server point of view, that looks like a usual form submission. +Du point de vue du serveur, cela ressemble à une soumission de formulaire habituelle. -## Sending a simple form +## Envoi d'un formulaire simple -Let's send a simple form first. +Envoyons d'abord un formulaire simple. -As you can see, that's almost one-liner: +Comme vous pouvez le voir, c'est presque une ligne : ```html run autorun