将图像上传到服务器并将路径保存到数据库. [英] Upload image to server and save the path into database.

查看:74
本文介绍了将图像上传到服务器并将路径保存到数据库.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该怎么做.

A在C#中有一个应用 当我单击上传"按钮时,我要将要上传的图像上传到某个位置的服务器上,以记住柏德,

然后,

当我单击保存"按钮以保存数据库中的数据时,

< b>我对如何上传和记住路径感兴趣.</b>

若要保存并读取到数据库,我现在如何.


坦克,

How i can do that.

A have an aplication in C#
when i click the upload button, i what my image to bi uploaded to a server in a location, to remember the phat,

and then,

when i click the save button to save on the data in my database,

<b>I''m interested how to upload and remember the path.</b>

To save and read to database i now how.


tanks,

推荐答案

ASP.Net?

阅读本文如何使用ASP.NET上传图像 [ .NET图片上传 [
ASP.Net?

read this article How to upload an image using ASP.NET[^]
or .NET Image Uploading[^]


要将文件上传到服务器,请使用以下代码.假设您要将文件保存在网站的上载"文件夹中.


字符串路径= Server.MapPath(〜/Upload/");
FileUpload1.SaveAs(path + FileUpload1.FileName);//这会将文件保存在上传文件夹中.
In order to upload a file to server use the below code. Assuming that you want to save the file in Upload folder in your website.


string path = Server.MapPath("~/Upload/");
FileUpload1.SaveAs(path+FileUpload1.FileName);//this will save the file in upload folder.


这篇关于将图像上传到服务器并将路径保存到数据库.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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