javascript - How do I get the filename of an input file and display it again on button click without uploading it? -


i having hard time thinking on need achieve goals.

goals:
1. copy filename of file want upload , display when click on button not upload it.
2. able upload when submit button clicked.

steps:

step 1: choose file upload. click on choose file. enter image description here

step 2: should show name of file i've chosen on step 1. then, click on "next". enter image description here

step 3: clicking "next" display what's in step 2 it's grayed-out , instead of next button, there "submit" button. it's confirmation if sure upload file. when click on "submit", that's time file gets uploaded.
enter image description here

so need able step 3. don't know how though. :'( .
i using php , js on this.

i not sure if question correct. feel free provide corrections well.

any very appreciated. much!!!

here quick snippet to, hopefully, going:

<body>      <input type="file" name="upload" id="upload">     <div id="filename"></div>      <script type="text/javascript">      $('#upload').on('change',function(){        // output raw value of file input        $('#filename').html($(this).val());           // or, manipulate further regex etc.         var filename = $(this).val();         // .. magic          $('#filename').html(filename);     });      </script>  </body> 

this output like: c:\fakepath\screenshot_2015-56-03_12-56.jpg in opera, absolute path file in ie 11 c:\users\foo\desktop\file.jpg

you can further manipulate value of file input field isolate filename using regex etc.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -