質問

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" />
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top