用于上传图像并将其存储到文件夹和数据库中的代码 [英] code for upload image and store into folder and database
本文介绍了用于上传图像并将其存储到文件夹和数据库中的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用于上传图像并存储到文件夹和数据库中的代码?
code for upload image and store into folder and database?
推荐答案
尝试一下:
Try This :
string path = "",file_path="",image_path="";
path = Server.MapPath("images/");
if (FileUpload1.HasFile)
{
string file_ext = System.IO.Path.GetExtension(FileUpload1.FileName);
FileUpload1.SaveAs(path + FileUpload1.FileName + file_ext);
image_path = "images/"+FileUpload1.FileName+ file_ext; // path for store in Database
Apply the Insert Query with image_path
}
如果有任何疑问,请发表....
If any query Please Post it....
请参考以下链接,
[
please refer the below link,
[^]
请参阅以下链接:
http://forums.asp.net/t/1323435.aspx [ http://www.aspdotnet-suresh.com/2011/03/how-to-save-images-into-folder-and.html [
Refer following links:
http://forums.asp.net/t/1323435.aspx[^]
http://www.aspdotnet-suresh.com/2011/03/how-to-save-images-into-folder-and.html[^]
这篇关于用于上传图像并将其存储到文件夹和数据库中的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文