如何在本地目录中保存图像

问题描述:

昨天我做了一个答案,但没有人理解我,重点是在我的应用程序中,用户可以在他的本地目录或互联网上选择一个图像,我想在我的数据库中保存客户端选择网址(已经如何这样做)同时将照片保存在我的本地目录(.jpg)上,因为如果在不久的将来用户删除他本地目录中的图片,我将丢失图片,所以当用户选择图片我我会得到网址,我需要将图片复制到我的本地目录(这是我的问题),以便在视图中显示。我希望有人可以帮助我。谢谢

yesterday I made an answer but nobody could not understand me, the point is that in my aplication the user can choose an image on his local directory or internet and I want to save the client selection url in my database(already how to do that) and at the same time save the photo on my local directory(.jpg) because if in a close future the user delete the picture on his local directory, i'll lost the picture, so when the user choose the picture i'll get the url and I need to copy the picture on my local directory(it is my problem), for showing after in a view. Please I hope that someone can help me. Thanks

if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(Server.MapPath("YourFolderName/" + FileUpload1.FileName));
        }







注意:此处为您的文件夹命名您要存储图像的位置。



谢谢

AARIF SHAIKH




Note: Here Give Your folder Name where you want to store image.

Thanks
AARIF SHAIKH


以下答案是根据我对你的问题的理解



当您从客户端计算机获取映像路径时,请编写一些将该映像上载到服务器的代码。然后它将在您的访问。此外,您也可以将图像放在本地目录中。
Below answer is according to my understanding about your question

When you are getting the path of image from client machine, write some code that will upload that image to server. Then it ll be in your access. Further you can have the image on your local directory too.