[英]C# How to programmatically import files into Visual Studio project
I have a file upload control that imports files into a directory on the server.我有一个文件上传控件,可以将文件导入服务器上的目录。 I would like to import the file in the servers file system into my project programmatically using C#.我想使用 C# 以编程方式将服务器文件系统中的文件导入我的项目中。 It is an image that I would like to import so I can display that image to the website.这是我想导入的图像,因此我可以将该图像显示到网站上。 An Alternative method maybe when I use the file upload control, to import directly into the websites folder.另一种方法可能是当我使用文件上传控件时,直接导入到网站文件夹中。 Can anyone help with this?有人能帮忙吗?
The code I have is as follows:- Image1.ImageUrl = "~c:\users\fitzy\documents\visual studio\2013\Projects\PhotoGallery3\PhotoGallery3\photos\Appliance Insurance.JPG";我的代码如下:- Image1.ImageUrl = "~c:\users\fitzy\documents\visual studio\2013\Projects\PhotoGallery3\PhotoGallery3\photos\Appliance Insurance.JPG";
I want to be able to display the imported image using Image1.ImageUrl but the path on the server does not let me.我希望能够使用 Image1.ImageUrl 显示导入的图像,但服务器上的路径不允许我。
Since we do not know the error message, I am sharing 2 mostly possible reasons:由于我们不知道错误消息,我分享两个最可能的原因:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.