404尝试上载文件时出错。 [英] 404 Error when trying to Upload a file.
问题描述
我正在尝试运行以下脚本并收到错误:
使用2参数调用UploadFile的异常:远程服务器返回错误:(404)未找到。
在C:\ config \ ftp1.ps1:16 char:22
+ $ webclient.UploadFile< ;<<< ($ uri,$ item.FullName)
+ CategoryInfo:NotSpecified:(:) [],MethodInvocationException
+ FullyQualifiedErrorId:DotNetMethodException
我试图运行的脚本是:
$ Dir =c:\ images \
$ ftp = http:// ..............
$ user =username
$ pass =password
ftp url :$ ftp
$ webclient = New-Object System.Net.WebClient
$ webclient.Credentials = New-Object System.Net.NetworkCredential($ user,$ pass)
正在上传$ item ...
foreach($ item in(dir $ Dir*。*)){
$ uri = New-Object System.Uri($ ftp + $ item.Name )
正在上传$ item ...
$ webclient.UploadFile($ uri,$ item.FullName)
}
上传完成
退出
任意我会很感激,我会把头发拉出来。
谢谢
webclient.UploadFile<<<< (
uri,
item.FullName)
+ CategoryInfo:NotSpecified:(:) [],MethodInvocationException < br $>
+ FullyQualifiedErrorId:DotNetMethodException
我试图运行的脚本是:
I am trying to run the following script and i get an error:
Exception calling "UploadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found."
At C:\config\ftp1.ps1:16 char:22
+ $webclient.UploadFile <<<< ($uri, $item.FullName)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
The script i am trying to run is :
$Dir = "c:\images\" $ftp = "http://.............." $user = "username" $pass = "password" "ftp url: $ftp" $webclient = New-Object System.Net.WebClient $webclient.Credentials = New-Object System.Net.NetworkCredential ($user, $pass) "Uploading $item..." foreach($item in (dir $Dir "*.*")){ $uri = New-Object System.Uri($ftp+$item.Name) "Uploading $item..." $webclient.UploadFile($uri, $item.FullName) } "Upload Complete" exit
Any ideas would be appreciated, i am pulling my hair out.
Thanks
webclient.UploadFile <<<< (
uri,
item.FullName)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
The script i am trying to run is :
这篇关于404尝试上载文件时出错。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!