文件从远程服务器完整路径 [英] Full path of the file from the remote server

查看:406
本文介绍了文件从远程服务器完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正与文件,我真的不知道如何使它发挥作用。

I am working with files and I don't really understand how to make it work.

我有一个Web应用程序(C#)位于在服务器上,用户使用该应用程序上传的文件的一些信息。说我有用户从本地计算机上传的文件(使用 HttpPostedFileBase 类),但code尝试匹配相同的路径在服务器上,问题当然,该文件不存在于服务器上,这就是为什么它抛出一个错误,指出

I have a web application (c#) that is located on the server and users use this application to upload some information from the files. The problem that I am having that users upload the file (using HttpPostedFileBase class) from their local machines but code is trying to match the same path on the server and of course the file doesn't exist on the server, that's why it throws an error saying that

找不到路径的一部分......

Cannot find a part of the path ...

如果用户试图上载从文件C:\用户\用户1 \文档\ FILE.TXT 从本地机器我怎么能写code到包括整个路径,包括计算机名称和本地驱动器类似 \\计算机名\文件c $ \用户\用户1 \ Documnets \ FILE.TXT

If the user is trying to upload the file from C:\Users\User1\Documents\File.txt from their local machine how can I write the code to include the whole path to the file including the computer name and the local drive something like \\ComputerName\c$\Users\User1\Documnets\File.txt.

推荐答案

您不能。客户端和服务器都从彼此断开。这是怎样的网络工作。你不能得到完整的客户端的路径和访问以任何方式从服务器。

You can't. Client and servers are disconnected from each other. That is how the web works. You can't get the full client path and access that in any way from the server.

有很好的理由,最重要的是安全性/信任。

There are very good reasons for this, the most important one is security / trust.

这篇关于文件从远程服务器完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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