0

i want to allow user to select an audio file and play it on browser. first, i use file input to get the audio file data

<input type='file'/>

let say X represent that input, so if user select a file, i can get the file data from X.files

then, i want to send the data to this tag

<audio ...></audio>

and provide the UI to allow user to control the audio

How can i do this thing WITHOUT go through server?

Najib Razak
  • 149
  • 1
  • 2
  • 8

2 Answers2

0

You can't do this without going through a server!

Please check this:

How to get the file path from HTML input form in Firefox 3


"<input type="file" />" Is most notably used for uploading files on a remote server.

If you wish to create a web site where users can play their uploaded music or view their videos, you should consider using some Server-Side technologies to achive file uploading.

You can start with one of the following:

Community
  • 1
  • 1
0

Store the audio file in the server that you are selecting and uploading using

<input type-"file"> tag.

during that process keep the path of that audio for your reference and give that path to your audio tag to play it.

Hope that helps.

Alagesan Palani
  • 1,984
  • 4
  • 28
  • 53