input file type get name
|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
input file type get namehi,
I was wondering if anyone knows a way to get the file name(the one the user has just browsed and is about to upload using the form) from a form input. I tried $("#fileInput").val() but it does not work. cheers, |
|
|
Re: input file type get nameThe .val() should work. I've tried it and it works on FF3.5, IE6+,
Safari and Chrome (all WinXP). The only differences I found is that FF, Safari, Chrome returns just the filename, whereas IE6+7 returns the full path of the user file (privacy issue), and IE8 uses 'C:\fakepath' as the directory (misleading..). On Oct 30, 8:29 am, Adonis <achrysoch...@...> wrote: > hi, > > I was wondering if anyone knows a way to get the file name(the one the > user has just browsed and is about to upload using the form) from a > form input. > I tried $("#fileInput").val() but it does not work. > > cheers, |
|
|
Re: input file type get namewell,
I ll be more specific, here is the code part ** $("#image_overlay_group_form").ajaxForm({ success: function(msg) { var downLat = $("#image_overlay_sw_lat").val(); var downLon = $("#image_overlay_sw_lng").val(); var upLat = $("#image_overlay_ne_lat").val(); var upLon = $("#image_overlay_ne_lng").val(); var fileName = $("#image_overlay_file").val(); alert("rs image filename: " + fileName + " , " + upLon + ", "+ downLat); // --> this has empty values!! $("#" + project_name + "_" + layer_name +"_"+ group_name+ "_new_legend_feature_entry_point").after(msg); }, resetForm: true // Reset the form after a successful AJAX call }); ** my guess is that the form inputs are emptied somehow and thus no values are available...but in some other ajaxForms i have, i use the same technique and it works.. I ll keep trying but any suggestions are much appreciated! On Oct 30, 7:29 pm, James <james.gp....@...> wrote: > The .val() should work. I've tried it and it works on FF3.5, IE6+, > Safari and Chrome (all WinXP). > The only differences I found is that FF, Safari, Chrome returns just > the filename, whereas IE6+7 returns the full path of the user file > (privacy issue), and IE8 uses 'C:\fakepath' as the directory > (misleading..). > > On Oct 30, 8:29 am, Adonis <achrysoch...@...> wrote: > > > hi, > > > I was wondering if anyone knows a way togetthe file name(the one the > > user has just browsed and is about to upload using the form) from a > > forminput. > > I tried $("#fileInput").val() but it does not work. > > > cheers, |
|
|
Re: input file type get nameok, problem was the resetForm:true.
Setting it to false fixes the empty values...for now. cheers, On Nov 2, 6:46 pm, Adonis <achrysoch...@...> wrote: > well, > I ll be more specific, here is the code part > > ** > $("#image_overlay_group_form").ajaxForm({ > success: function(msg) { > var downLat = $("#image_overlay_sw_lat").val(); > var downLon = $("#image_overlay_sw_lng").val(); > var upLat = $("#image_overlay_ne_lat").val(); > var upLon = $("#image_overlay_ne_lng").val(); > var fileName = $("#image_overlay_file").val(); > alert("rs image filename: " + fileName + " , " + upLon > + ", "+ downLat); // --> this has empty values!! > > $("#" + project_name + "_" + layer_name +"_"+ > group_name+ "_new_legend_feature_entry_point").after(msg); > > }, > resetForm: true // Reset the form after a successful AJAX > call > }); > ** > > my guess is that the form inputs are emptied somehow and thus no > values are available...but in some other ajaxForms i have, i use the > same technique and it works.. > I ll keep trying but any suggestions are much appreciated! > > On Oct 30, 7:29 pm, James <james.gp....@...> wrote: > > > The .val() should work. I've tried it and it works on FF3.5, IE6+, > > Safari and Chrome (all WinXP). > > The only differences I found is that FF, Safari, Chrome returns just > > the filename, whereas IE6+7 returns the full path of the user file > > (privacy issue), and IE8 uses 'C:\fakepath' as the directory > > (misleading..). > > > On Oct 30, 8:29 am, Adonis <achrysoch...@...> wrote: > > > > hi, > > > > I was wondering if anyone knows a way togetthe file name(the one the > > > user has just browsed and is about to upload using the form) from a > > > forminput. > > > I tried $("#fileInput").val() but it does not work. > > > > cheers, |
| Free embeddable forum powered by Nabble | Forum Help |