404尝试上载文件时出错。 [英] 404 Error when trying to Upload a file.

查看:80
本文介绍了404尝试上载文件时出错。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行以下脚本并收到错误:



使用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屋!

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