【问题标题】:The SaveAs method is configured to require a rooted path, and the path is not rootedSaveAs 方法配置为需要有根路径,并且路径没有根
【发布时间】:2023-03-24 07:05:01
【问题描述】:

我们正在移动在 32 位服务器中运行的 Web 应用程序作为网站,也在 64 位服务器中运行。

在将文本文件上传到服务器时出现如下错误:

"SaveAs方法被配置为需要root路径,而路径http:\\mypath\CitiDirect\TimeSheet2.txt没有root。 "

但它在 32 位服务器上工作正常,就像在 Web 应用程序中一样。 文件上传代码为:

FileUpload1.SaveAs("\\" & Request.ServerVariables("LOCAL_ADDR") _
                        & "\CitiDirect$\TimeSheet2.txt")

【问题讨论】:

    标签: c# .net vb.net


    【解决方案1】:

    您可以使用此解决方法:

    将文件上传到临时文件夹,然后使用

    Fileupload1.SaveAs("\\" & yourtmppath)
    file.move(source,destination)
    

    然后使用这个因为如果源正在使用中,它将被复制但不会从原始目录中删除

    if file.exist(source) then file.delete(source)
    

    【讨论】:

      猜你喜欢
      • 2010-11-15
      • 2010-11-23
      • 1970-01-01
      • 2011-12-13
      • 1970-01-01
      • 2018-07-11
      • 1970-01-01
      • 2014-09-26
      • 2015-11-14
      相关资源
      最近更新 更多