rejetto forum

File Upload Script

0 Members and 1 Guest are viewing this topic.

Offline daniel_boc

  • Occasional poster
  • *
    • Posts: 1
    • View Profile
Hello,

I am trying to upload files via script. Is there any way to do this via powershell or curl?

I have tried via powershell with this :
#File to Send
$itemName="itemPath"

#http server
$http = "http://meu-ip"
$user = "user"
$pass = "passwd"
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass) 


try{
$uri = New-Object System.Uri($http+"fileDestName.txt")
$webclient.UploadFile($uri, $itemName)}#end try

catch{
$err=$_
Write-Host $error.exception.message
}

but this return erro 404 - Not Found....

And i have tried with this in curl:

curl --user login:password --upload-file "filepath" http://meu-ip/namefile

but this return the same erro 404 - Not Found.




Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
there were other post on the forum with other users trying to upload file to hfs via script. unknown if any were successful.

id use w g e t html-put method or cURL:
https://superuser.com/questions/130009/how-can-i-do-a-http-put-with-wget

here is what i have found on previous posts:

http://rejetto.com/forum/index.php?topic=6813.msg1042159#msg1042159

http://rejetto.com/forum/index.php?topic=6463.msg1039172#msg1039172

http://www.rejetto.com/forum/index.php?topic=4877.0
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing