如何使用带代码的c#在asp.net上传图像以使用file uploder命令 [英] how to upload image in asp.net using c# with code to use file uploder command
本文介绍了如何使用带代码的c#在asp.net上传图像以使用file uploder命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请给我代码如何使用c#上传图像,使用c#代码使用文件上传命令
pls give me code how to upload image in asp.net using c# with code to use file uploder command
推荐答案
protected void UploadThisFile(FileUpload upload)
{
if (upload.HasFile)
{
string theFileName = Path.Combine(Server.MapPath("~/Uploads"), upload.FileName);
if (File.Exists(theFileName))
{
File.Delete(theFileName);
}
upload.SaveAs(theFileName);
}
}
protected void buttonUpload_Click(object sender, System.EventArgs e)
{
UploadThisFile(FileUpload1);
}
http://r4r.co.in/asp.net/01/tutorial/asp.net/image_upld.shtml [ ^ ]
使用上面的链接并关注它
http://r4r.co.in/asp.net/01/tutorial/asp.net/image_upld.shtml[^]
use above link and follow it
您好,
请参考以下链接,它将为您提供解决方案要求。
文件上传和文件类型 - 扩展检查
希望这将解决要求。
问候,
Mubin
Hi ,
Please refer the following Link which will provide solution to your requirement.
File Upload and FileTypes-Extension Check
Hope this will solve the requirement.
Regards,
Mubin
这篇关于如何使用带代码的c#在asp.net上传图像以使用file uploder命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文