Forum

Results 1 to 5 of 5
  1. #1
    Join Date
    January 2019
    Location
    Germany
    Posts
    44

    How to use filetransfer protocol?

    Hello,

    is it possible to use the filetransfer protocol with the api?
    I checked currently my files with the server query:
    Code:
    [email protected](1):online> ftgetfilelist cid=1 cpw= path=/
    cid=1 path=\/ name=myfile.tar.gz size=5245060 datetime=1548670554 type=1
    error id=0 msg=ok
    [email protected](1):online> ftinitdownload clientftfid=1 name=\/myfile.tar.gz cid=1 cpw= seekpos=0
    clientftfid=1 serverftfid=2 ftkey=u8DauuKGoue8PqSpEfOXP5YtO36j02Hr port=30033 size=5245060 proto=0
    error id=0 msg=ok
    How can I download now this file? Is there any api documentation for the fileserver (port 30033)?

    kind regards
    Peter

  2. #2
    Join Date
    September 2012
    Posts
    6,076
    You simply open a connection to the filetransfer port indicated and send the transfer key. Upon receiving the key the server will then send you the designated file on that connection. That is once you opened the connection and sent the key, you will receive the data of the file that you can then save to disk or do whatever with.

    Uploading works the same, but instead of the server sending you stuff, it expects you to send the file after sending the transfer key.
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  3. #3
    Join Date
    January 2019
    Location
    Germany
    Posts
    44
    Quote Originally Posted by Chris View Post
    You simply open a connection to the filetransfer port indicated and send the transfer key. Upon receiving the key the server will then send you the designated file on that connection. That is once you opened the connection and sent the key, you will receive the data of the file that you can then save to disk or do whatever with.

    Uploading works the same, but instead of the server sending you stuff, it expects you to send the file after sending the transfer key.
    Thanks for your answer. I tested this for uploading a file:

    Serverquery:
    Code:
    send: ftinitupload clientftfid=1 name=\/test.png cid=1 cpw= size=29333 overwrite=1 resume=0
    answer: clientftfid=1 serverftfid=3 ftkey=9VLNIsCS+BzH6wbu1ZvBlHVQbJq5lGw0 port=30033 seekpos=0 proto=0
    PHP-Code: https://pastebin.com/BnbwSete
    (sorry can not post the PHP code her, because cloudflare is blocking this)

    The problem is, that the file on the server ist empty after upload.

    On downloading a file, I have the same problem:
    Code:
    send: ftinitdownload clientftfid=1 name=\/myfile.tar.gz cid=1 cpw= seekpos=0
    answer: clientftfid=1 serverftfid=3 ftkey=\/e8SE81Dtn4l\/NwlIMLvXHFutoXjilTk port=30033 size=5245060 proto=0
    PHP-Code: https://pastebin.com/YerfvbwQ
    The result of fread is false
    Last edited by Hanashi; January 28th, 2019 at 01:16 PM.

  4. #4
    Join Date
    September 2012
    Posts
    6,076
    The keys are not valid for very long (a few seconds), so most likely the key expired before you are able to hard code it in and run the script.

    Please note that you're dealing with binary data here while using PHP string functions. Not sure how PHP deals with that or whether these functions are suitable for binary data.
    Last edited by Chris; January 28th, 2019 at 01:46 PM.
    When sending PMs please make sure to include a reference link to the thread in question in the body of your message.

  5. #5
    Join Date
    January 2019
    Location
    Germany
    Posts
    44
    Thank you, my problem was of course the expired key. Now it works

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. mSL and Ts3 protocol
    By Johnathanz in forum Client Plugins / Lua Scripts
    Replies: 0
    Last Post: August 17th, 2016, 09:54 AM
  2. Replies: 1
    Last Post: July 10th, 2015, 06:35 PM
  3. Protocol mismatch
    By PeterW in forum Windows
    Replies: 1
    Last Post: January 27th, 2010, 08:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •