Шукати в статтях підтримки

Остерігайтеся нападів зловмисників. Mozilla ніколи не просить вас зателефонувати, надіслати номер телефону у повідомленні або поділитися з кимось особистими даними. Будь ласка, повідомте про підозрілі дії за допомогою меню “Повідомити про зловживання”

Докладніше

Ця тема перенесена в архів. Якщо вам потрібна допомога, запитайте.

How does Firefox and AWS S3 initiate an upload after a form post to S3

  • 1 відповідь
  • 1 має цю проблему
  • 1 перегляд
  • Остання відповідь від glez

more options

I'm trying to understand how AWS pulls a file from a client device after I post an upload request to AWS S3. HTML is asynchronous and I can't figure out how, after I post the file name and such, an upload is started.

I’m uploading images from a user’s device to a S3 bucket using a HTML form. Everything is working fine but I don’t understand how the S3 server can initiate an upload from a client browser after the form data (file name, signature, policy, etc.) has been posted to its URL. The image data is in a file on the client device and is not contained in the form, only the file name is there. Where in the process is the upload started and how does the S3 server tell the client browser to upload the image data?

Perhaps there’s more communication between the web server and browser during a post/response that I’m not aware of. Perhaps AWS and Firefox have a WebSocket open to perform the file upload?

Any insight would be appreciated.

I'm trying to understand how AWS pulls a file from a client device after I post an upload request to AWS S3. HTML is asynchronous and I can't figure out how, after I post the file name and such, an upload is started. I’m uploading images from a user’s device to a S3 bucket using a HTML form. Everything is working fine but I don’t understand how the S3 server can initiate an upload from a client browser after the form data (file name, signature, policy, etc.) has been posted to its URL. The image data is in a file on the client device and is not contained in the form, only the file name is there. Where in the process is the upload started and how does the S3 server tell the client browser to upload the image data? Perhaps there’s more communication between the web server and browser during a post/response that I’m not aware of. Perhaps AWS and Firefox have a WebSocket open to perform the file upload? Any insight would be appreciated.

Обране рішення

Further research has shown that the browser itself automatically formats each file as a part of the form submission when the form has an input type="file" control. The file becomes an intrinsic part of the form data submitted and the server side processing knows to look for it as such.

HTML4 input type="file" spec

"The following example shows how the contents of a user-specified file may be submitted with a form. The user is prompted for his or her name and a list of file names whose contents should be submitted with the form. By specifying the enctype value of "multipart/form-data", each file's contents will be packaged for submission in a separate section of a multipart document."

Читати цю відповідь у контексті 👍 0

Усі відповіді (1)

more options

Вибране рішення

Further research has shown that the browser itself automatically formats each file as a part of the form submission when the form has an input type="file" control. The file becomes an intrinsic part of the form data submitted and the server side processing knows to look for it as such.

HTML4 input type="file" spec

"The following example shows how the contents of a user-specified file may be submitted with a form. The user is prompted for his or her name and a list of file names whose contents should be submitted with the form. By specifying the enctype value of "multipart/form-data", each file's contents will be packaged for submission in a separate section of a multipart document."