Author Topic: File Upload Script  (Read 704 times)

0 Members and 1 Guest are viewing this topic.

Offline daniel_boc

  • Occasional poster
  • *
  • Posts: 1
    • View Profile
File Upload Script
« on: January 31, 2018, 01:55:30 PM »
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

  • Insane poster
  • *****
  • Posts: 732
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: File Upload Script
« Reply #1 on: February 03, 2018, 07:50:45 AM »
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
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1