将FileUpload中的文件保存到VB.NET Web应用程序中的网络路径 [英] Save file in FileUpload to network path in VB.NET web app

查看:76
本文介绍了将FileUpload中的文件保存到VB.NET Web应用程序中的网络路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


当用户单击浏览时,他从str2 = "d:\data\dump\xxx.dmp"中选择一个 .dmp 文件,然后单击继续"按钮,以保存到该计算机上ls_backupthumb2 = "\\192.168.1.111\c:\tdata\"
中的文件夹中的另一台计算机.

Hi
When a user clicks browse, he selects a .dmp file from str2 = "d:\data\dump\xxx.dmp" and clicks on proceed button, to save to another PC in a folder on that PC, in ls_backupthumb2 = "\\192.168.1.111\c:\tdata\"

FileUpload fileUpload1.PostedFile.SaveAs(Path.Combine(ls_backupthumb2, str2))



这样对吗?请提供这种类型的示例或引用的链接

一位朋友建议使用假冒,但我不熟悉.

它是VB.NET中的Web应用程序.



Is this correct? Please give an example with this type or a link to a reference

A friend suggested using impersonation but I am not familiar with it.

It is a web application in VB.NET.

推荐答案

FileUpload fileUpload1;



fileUpload1应该已经有上传的文件,您不需要客户端本地驱动器上的路径.

FileUpload.SaveAs fileUpload1.PostedFile.SaveAs保存到Web服务器(应用程序运行所在的位置),因此只有在IIS进程具有对目标路径的写访问权的情况下,它才起作用.
您要写入的网络路径是什么?是在服务器上还是在其他地方?

BTW \\ 192.168.1.111 \ c:\ tdata \ 没有任何意义,您无法像这样访问C:\,也许 \\ address \ c



fileUpload1 should already have the uploaded file, you don''t need the path on the client''s local drive.

FileUpload.SaveAsfileUpload1.PostedFile.SaveAs saves to the web server (where the application runs), so it will only work if the IIS process has write access to the target path.

What is the network path you want to write to? Is it on the server or elsewhere?

BTW \\192.168.1.111\c:\tdata\ makes no sense, you can''t access C:\ like that, maybe \\address\c


(取决于操作系统).

-更新-
以下评论的详细信息(快速和肮脏的方法)
  • 共享计算机上要保存到的任意文件夹.假设 C:\ shared \ websave \ 与名称 websave 共享,然后以 \\ 192.168.1.xxx \ websave
  • 将对 Everyone 组的完全访问权限授予文件夹共享
(depending on OS).

-- update --
Details of comment below (quick & dirty method)
  • Share an arbitrary folder on the machine to save to. Say C:\shared\websave\ is shared with name websave, then you access it as \\192.168.1.xxx\websave
  • Grant full access to the Everyone group to the folder share
fileUpload.PostedFile.SaveAs(@"\\192.168.1.xxx\webshare\filename.dmp");

(您必须转换为VB,我不能手写一下)

  • 指尖并希望它能起作用
  • (you''ll have to convert to VB, I can''t write it offhand)

  • Cross fingers and hope it works

  • 这篇关于将FileUpload中的文件保存到VB.NET Web应用程序中的网络路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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