Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 HTML.BeginForm 上传文件。这部分工作正常。
但是,除了上传文件之外,我还想在同一页面上使用所选文件的名称填充一个字段。
有没有办法做到这一点?
编辑:我想知道上传的文件的名称(上传发生后)。
您可以使用jQuery .change将所选文件的名称附加到要显示的 div/区域
$('#myFile').change( function() { var uploadeFile= $(this).val(); //Append uploadedFile to a div/area });
HTML
<input type="file" id="myFile" />