我刚刚将一个站点从专用服务器移动到GoDaddy共享主机帐户,并且刚刚遇到了大量问题!一个是ASP上传。
在Classic ASP中,我通常会将文件上传到我的文件夹:
Set upload = Server.CreateObject("Persits.Upload")
uploadPath = Server.MapPath("../../files/photos/"&token_&"/")
upload.IgnoreNoPost = True
upload.Save(uploadPath)
Set upload = Nothing
但是自从转到GoDaddy后,我收到了这个令人讨厌的消息:
This feature has been disabled by the system administrator. Use SaveVirtual instead.
我继续使用ASP上传的网站文档,但我找不到 SaveVirtual ,只有 SaveAsVirtual ,这就是我失去的地方。
我尝试过使用SaveAsVirtual,但是它发出错误声明我正在使用物理路径而我应该使用虚拟路径!我真的不明白这一点,并希望有人可以让我直截了当。我的网站现在被视为已损坏且处于离线状态,请提供帮助。
这是我在物理/虚拟路径错误之前尝试过的:
Set upload = Server.CreateObject("Persits.Upload")
uploadPath = Server.MapPath("../../files/photos/"&token_&"/")
upload.IgnoreNoPost = True
upload.SaveAsVirtual(uploadPath)
Set upload = Nothing
答案 0 :(得分:4)
根据docs,该方法名为SaveVirtual
。它会为您进行Server.MapPath
转换。
所以,试试:
Set upload = Server.CreateObject("Persits.Upload")
uploadPath = "../../files/photos/"&token_&"/"
upload.IgnoreNoPost = True
upload.SaveVirtual(uploadPath)
Set upload = Nothing
答案 1 :(得分:1)
您已设置上传的文件夹路径,不需要像“server.mappath”
那样使用请使用以下代码。
Set Upload = Server.CreateObject("Persits.Upload" )
Upload.SetMaxSize 10000000 ' Maksimum dosya büyüklüğü Byte cinsinden
Upload.OverwriteFiles = True
Path = "../../duyurular/"
Count = Upload.SaveAsVirtual(Path)
答案 2 :(得分:0)
对于godaddy,您必须进入并更改服务器文件夹的读/写权限。否则,您会收到该错误消息。
答案 3 :(得分:0)
我也遇到过这个问题,我刚从 Go-daddy 托管服务器更改了文件夹权限,因此任何人都可以从特定位置读取或写入文件
非常感谢 Ahsan Aziz Abbasi