Storing the image from an HTML input file form locally

后端 未结 4 1927
忘掉有多难
忘掉有多难 2021-01-05 20:36

I was wondering if it is possible to store the image from


locally. Would I have to store the imag

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-05 21:02

    No. Since storing a file or accessing a file on the local OS would violate the permissions of the browser. So your scripts cannot access the content unless it has been uploaded to the server. Also different browsers handle the path of the file that has been selected in different ways. So you encounter a number of problems there.

    That said, there are some ways to get around this that I will not discuss. Simply put, the image should be uploaded to the server in some fashion and then your scripts can reference the path or the image itself from the path that it was uploaded to.

提交回复
热议问题