asp.net MVC3.0 : callbacks for use with HTML.BeginForm
-
22-03-2021 - |
質問
I am using HTML.BeginForm to upload files. This part works fine.
However, in addition to uploading files, I would like to populate a field on the same page with the name of the file selected.
Is there any way to do this?
edit: I am seeking to know the name of the file uploaded (after the upload happens).
解決
You can use jQuery .change to append the name of the selected file to the div/area you want to display it
$('#myFile').change( function()
{
var uploadeFile= $(this).val();
//Append uploadedFile to a div/area
});
HTML
<input type="file" id="myFile" />
所属していません StackOverflow