How do I get the actual file from an Input type file element?

Viewed 2367

var file = e.target.files[0];

or

var file = e.target.value;

I'm using React and Socket io to try to sent images over chat. All I've been able to get is the file path not the actual file. I've never handled file inputs so I'm trying to figure out how to take that file and convert it to a binary string I can send over socket io.

help? any packages you would recommend?

1 Answers
Related