locked
Issue while uploading file through FTP using PSFTP module RRS feed

  • Question

  • Hi Guys,

    I am facing a issue while trying to upload a file through FTP using PSFTP module which i have highlighted below.  From the error i can find that the FTP location is considering both the source and destination path. I am not sure how to fix this issue. Can someone help me with this.

    Code:

    Import-Module PSFTP 
    Set-FTPConnection -Credentials username -Server ftp://servername.com -Session MyTestSession
    $FTP = "ftp://servername.com"
    $FTPPath = "C:\Users\username\Desktop\Scripts\FTP\testfile.txt"
    Add-FTPItem -Path $FTP -LocalPath $FTPPath -Session MyTestSession -Verbose

    Error output after the FTP connection is established:

    VERBOSE: Performing the operation "Send item: 'C:\Users\username\Desktop\Scripts\FTP\testfile.txt' in ftp location" on target "ftp://servername.com/C:/Users/username/Desktop/Scripts/FTP/testfile.txt".
    Add-FTPItem : Exception calling "GetRequestStream" with "0" argument(s): "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)."
    At line:5 char:1
    + Add-FTPItem -Path $FTP -LocalPath $FTPPath -Session MyTestSession -Ve ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-FTPItem

    Regards

    Sathish

    • Moved by Bill_Stewart Monday, March 12, 2018 8:10 PM This is not "scripts on demand"
    Monday, January 15, 2018 10:56 PM

All replies

  • You do not have upload permission.

    Your issues are about a non-PowerShell module. Post issues to the author for more detailed help.


    \_(ツ)_/

    Monday, January 15, 2018 11:48 PM