![](/img/trans.png)
[英]How to get the path of the file I selected in a form of input file so I can upload with cloudinary the server side
[英]how to upload a file in localhost web server, and get the file path
我已經部署了一個 web localhost、http://localhost:8080 並包含以下代碼來獲取上傳文件。
<form action="/action_page.php">
<input type="file" id="myFile" name="filename">
<input type="submit">
</form>
我正在嘗試在我的 javascript 代碼中讀取本地 web 服務器中的文件名和文件路徑。 我怎樣才能得到那兩個?
您可以使用下面的 function 來獲取上傳文件的名稱、文件路徑、大小和其他一些信息。
const handleUploadClick = (event) => {
const file = event.target.files[0]
console.log(file) // returns an object
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.