如何使用C#将图像存储到asp.net中的文件夹中 [英] how to store image into the folder in asp.net using C#

查看:56
本文介绍了如何使用C#将图像存储到asp.net中的文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将图像存储在不在数据库中的图像文件夹中,我该怎么做呢。请提供我能理解的完整代码

i want to store image in image folder not in database,how can i do this.please give complete code that can i understand

推荐答案

<asp:FileUpload ID="fupload" runat="server" Height="21px" Width="220px" />



添加一个Asp按钮尝试下面的代码点击该按钮


Add One Asp Button try this below code in that button click

string strFileName = DateTime.Now.ToString("MM-dd-yyyy_HHmmss");
string strFileType = System.IO.Path.GetExtension(fupload.FileName).ToString().ToLower();
fupload.SaveAs(Server.MapPath("folderpath" + strFileName + strFileType));


请参考:

将图像保存到文件夹和数据库 [ ^ ]



这里是如何将图像保存到文件夹和图像中的好例子数据库中的路径,并使用asp.net 基于数据库中的图像路径显示gridview中文件夹中的图像[ ^ ]
Please refer:
Save Image to Folder and Database[^]

Here is good example of How to save images into folder and images path in database and display images from folder in gridview based on images path in database using asp.net[^]


请查看以下链接

http://www.c-sharpcorner.com/uploadfile/mahesh/fileupload10092005172118pm/fileupload.aspx [ ^ ]
please check the following link
http://www.c-sharpcorner.com/uploadfile/mahesh/fileupload10092005172118pm/fileupload.aspx[^]


这篇关于如何使用C#将图像存储到asp.net中的文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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