0

I have a model with many attributes, and image is one of them. How can I send a picture to the server alongside with the other attributes using the save method ?

vvahans
  • 1,849
  • 21
  • 29
elhoucine
  • 2,356
  • 4
  • 21
  • 37

1 Answers1

0

You probably want to use the FileReader API as described in answers here or here. However, it's been noted that FileReader isn't supported in older browsers, such as IE<10, so if it's important to you to support these browsers you might want to send the image to the server after the user selects it, and have the server respond with a binary representation of the image or a unique id that refers to the image now stored on the server.

Community
  • 1
  • 1
Hart Simha
  • 862
  • 8
  • 14