Get filename from input [type='file'] using jQuery

前端 未结 11 1025
陌清茗
陌清茗 2020-12-23 20:15

This is the uploaded form.

11条回答
  •  北海茫月
    2020-12-23 20:22

    This isn't possible due to security reasons. At least not on modern browsers. This is because any code getting access to the path of the file can be considered dangerous and a security risk. Either you'll end up with an undefined value, an empty string or an error will be thrown.

    When a file form is submitted, the browser buffers the file temporarily into an upload directory and only the temporary file name of that file and basename of that file is submitted.

提交回复
热议问题