使用c#函数从asp.net访问文件. [英] Access file from asp.net using c# function .

查看:62
本文介绍了使用c#函数从asp.net访问文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从ASP.net中的文件夹访问文件(图像,音频或视频)?我也想从本地计算机或服务器上载它.请在这方面帮助我.由于我是初学者,请给我完整的代码.
再次感谢.

How to access a file (image,audio or video) from a folder in ASP.net? Also i want to upload it either from local machine or server. Kindly help me in this. As i''m a beginner plz give me the complete code.
Thanks Again.

推荐答案

在解决方案资源管理器中创建一个文件夹

在您的上传按钮上,点击使用此

make a folder in your solution explorer

on your upload button click use this

string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
           FileUpload1.SaveAs(Server.MapPath("Images/" + filename));




用于下载
使用




for downloading
use

string c = "Images" + "/" + filename.Text ;
        Response.Redirect(c);


这篇关于使用c#函数从asp.net访问文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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