如何解决fileupload saveas方法图像图标为空白? [英] how to solve the fileupload saveas method the image icon is blank?

查看:77
本文介绍了如何解决fileupload saveas方法图像图标为空白?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试上传文件,我想将图像保存到图像文件夹(在项目中创建的文件夹),
但是,该图像不知道出现在我指示的目录中

如果我显示所有文件,它将显示在此处,因此我单击该图像并将其包含在项目中,但是,
每次上传图片都不应该是这种情况,我需要再次重做

因此,当我上传图片时,如何让它始终显示?

这是我的代码

i trying to do a file upload, i want to image to save to image folder (a folder create in the project),
however, the image don''t know appear in the directory that i indicate

if i show all file, it appear there, so i click on that image and include it in the project,however,
it shouldnt be the case that i everytime upload an image, i need to redo that again

so how should i allow it to always appear when i upload a image?

this is my code

protected void uploadImage()
{
	string filename = FileUploadImg.FileName;
	string fileType = filename.Substring(filename.Length - 4).ToLower();
	if ((fileType == ".gif") | (fileType == ".jpg") | (fileType == ".png")) {
		FileUploadImg.SaveAs("C:\\Users\\Jane\\Desktop\\project\\FileUpload\\FileUpload\\WebRole1\\images\\" + txtboxName.Text + "_" + FileUploadImg.FileName);
	} else {
		Interaction.MsgBox("failed");

	}
}


< img src ="http://i286. photobucket.com/albums/ll115/cutexxbaby/blank.jpg"border =" 0"alt =" Photobucket>

推荐答案

不好想法-要自动将其包含在您的项目中,您必须编辑相关的.csproj文件和/或trhe resx文件.尽管这些都是XML格式,并且可读性很强,但我不知道直接修改对VS会有什么影响-可能不会注意到,可能会抱怨.就个人而言,我不会这样做.将其保存在远离您的项目的位置,然后手动添加.
Not a good idea - to automatically include it in your project, you would have to edit the relevant .csproj file and / or trhe resx file. While these are in XML and are perfectly readable, I do not know what effect direct modification will have on VS - it may not notice, it may complain. Personally, I wouldn''t do it. Save them well away from your project, and add them manually.


这篇关于如何解决fileupload saveas方法图像图标为空白?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆