如何在服务器中存储文件 [英] How to store the file in the server

查看:157
本文介绍了如何在服务器中存储文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序中,我正在使用文档上传.我将整个应用程序粘贴到服务器中,其中有一个名为Attach document的文件夹.当我单击上载按钮时,文件将存储在该文件夹中.它在本地系统上运行良好,但不适用于该服务器系统,它会提供登录失败消息.我正在使用server.mappath(~/attach document)函数来获取位置,但是它给出了该错误.谁能帮我解决这个问题.

在Advance中致谢

Hi,

In my application I am using the document upload. I will paste my whole application in the server, there is the folder named as attach document. When I click the upload button the file will be stored in that folder. it is working fine in local system, but it is not working for that server system it gives the logon failure message. I am using the server.mappath(~/attach document) function for getting the location but it gives that error. Can anyone help me to solve this problem.

Thanks in Advance

推荐答案

尝试
将文件上传到Web服务器 [
Try
Uploading files to a web server [^]

ServerSavePath := Server.MapPath(''/Upload'');



这将返回给定虚拟路径的物理路径.如果您的Web应用程序的根目录位于''c:\InetPub\WWWRoot\MyWebApplication''下,则Server.MapPath(''/Upload'')将返回''c:\InetPub\WWWRoot\MyWebApplication\Upload''.



This will return the physical path for a given virtual path. If your web application''s root is under ''c:\InetPub\WWWRoot\MyWebApplication'' then Server.MapPath(''/Upload'') would return ''c:\InetPub\WWWRoot\MyWebApplication\Upload''.




感谢您给出的答复,但是它给出了错误,因为"SaveAs方法配置为需要根目录,而路径''~/AttachDocument/ger.txt''没有根目录."
这是代码:

Hi,

Thanks for the reply I given this but it gives the error as "The SaveAs method is configured to require a rooted path, and the path ''~/AttachDocument/ger.txt'' is not rooted."
Here is the code:

string fileLocation = @"~/AttachDocument/";



谢谢



Thanks


我认为您没有相应权限,请先尝试设置权限.

谢谢
i think you don''t have a permission for that try to set the permission first.

thanks


这篇关于如何在服务器中存储文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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