1

I'd like to know if there is a way to remember the file path after the page refreshes?

JS:

audio_file.onchange = function(){
    var files = this.files;
    var file = URL.createObjectURL(files[0]); 
            audio_player.src = file; 
    audio_player.play();
};

HTML:

<input id="audio_file" type="file" accept="audio/*" />
<audio id="audio_player" />

You can see it here: http://jsfiddle.net/Tv8Cm/

Grasper
  • 1,293
  • 12
  • 26
  • You can add a "GET" on the link with the path as the variable: http://stackoverflow.com/questions/5233050/how-to-refresh-a-page-with-jquery-by-passing-a-parameter-to-url – Zander May 18 '15 at 16:00
  • @Cheshire, this is a good idea but it's not going to work for me since my website is inside the android app. So when I open the app it will load the default page and not the one with the get variable...what about cookies? – Grasper May 18 '15 at 16:47

1 Answers1

2

I think it's not posible, it would be a potential security leak, hiding it and getting files from the user's hard drive

monxas
  • 2,475
  • 2
  • 20
  • 36
  • if you have a variable with the path, sure, you can use localstorage, but, i'm quite sure you really never see the actual path to the file, you get the file but not the path to it. try to print the path and you'll see you don't really have it – monxas May 18 '15 at 17:21
  • ok, so I will leave it and the users will need to upload their own files each time. Thanks – Grasper May 18 '15 at 18:05