0

I'm making a music visualizer, and it's functional if the mp3 file is in the repository. So any songs it plays have to already be downloaded by me. I want to create kind of a drag and drop option where users can put mp3 files and then watch them being played. However, if at all possible, I'd like to avoid building an entire backend just for this one feature.

Is there a way to temporarily store a user file, which disappears on refresh?

Shiv Bhatia
  • 351
  • 1
  • 3
  • 10
  • Getting a file into the client, easy. Getting a file into server, impossible without some active component that is ready to receive it. For a music visualiser, it is probably enough that your client has the file, no? – Amadan Mar 06 '18 at 04:37
  • https://stackoverflow.com/a/47584467/6901876 This answer deals with the actual uploading, handling, and playing of the mp3 file, you would just have to add your own functionality for the drag-and-drop part of it. – Cannicide Oct 31 '19 at 21:54

1 Answers1

0

It sounds like you're looking for the FileReader API, which allows you to work with files in JavaScript after the user chooses them from a file picker. You can find more info here.

Googling "JavaScript FileReader sound" returns a ton of results, including:

Kevin Workman
  • 41,537
  • 9
  • 68
  • 107