shajin
shajin

Reputation: 3264

display image file name after choose file(web)

I need to display the file name after choose the file from file input on a HTML page(<input type=file>).I am using Ruby on rails(Probably it doesn't matter).Pls give me some hint

Upvotes: 0

Views: 1702

Answers (2)

dku.rajkumar
dku.rajkumar

Reputation: 18568

$('input[type="file"]').change(function(){
var file_name = $(this).val();
});

check the fiddle : http://jsfiddle.net/cGVCB/

Upvotes: 4

frank_neff
frank_neff

Reputation: 1012

I don't know Ruby, but i'm shure you can use Javascript / jQuery:

alert($('#idOfYourUploadField').val());

Combine it with a change listener, or something, to get it on every change.

Upvotes: 0

Related Questions