Results 1 to 6 of 6

Thread: File upload and download in Lianja

  1. #1
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,159
    Blog Entries
    22

    File upload and download in Lianja

    The "NetworkRequest" class provides support for http, https and ftp reading and writing files and other data such as making OData requests.

    It supports uploading and downloading with (optional) authenticated requests.

    It can be used by any of the supported scripting languages; Visual FoxPro, PHP, Python or JavaScript.

    If async is set to true, then you can subclass it and define an event handler called finished(data as character) that is passed the data received or the name of the filename containing the data when the request completes. If async is false then the operation is performed synchronously.

    When using it in async mode the progressChanged(currentvalue as numeric, totalsize as numeric) event handler is called allowing you to provide progress feedback to the user during the request.

    Additionally, in async mode you can call oRequest.isFinished() to determine if the request has completed.

    You can verify that you have a valid network connections using oRequest.networkAccessible() and check for errors using oRequest.errorNumber and oRequest.errorString

    Code:
    oRequest = createObject("networkrequest")
    oRequest.async = .f.
    oRequest.username = "yourname"
    oRequest.password = "yourpassword"
    oRequest.setHeader("name", "value")
    oRequest.setHeader("name2", "value")
    oRequest.getFile("http://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    oRequest.getFile("https://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    oRequest.getFile("ftp://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    oRequest.putFile("http://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    oRequest.putFile("https://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    oRequest.putFile("ftp://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    oRequest.postFile("http://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    oRequest.postFile("https://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    oRequest.postFile("ftp://www.anywhere.com/filename.xxx?arg=value&arg2=value", filename)
    m_string = oRequest.getData("http://www.anywhere.com/filename.xxx?arg=value&arg2=value")
    oRequest.putData("http://www.anywhere.com/filename.xxx?arg=value&arg2=value", "send this to the server")
    oRequest.postData("http://www.anywhere.com/filename.xxx?arg=value&arg2=value", "send this to the server")
    You can use this class very effectively when working with OData services in the Cloud.
    Last edited by barrymavin; 2013-03-28 at 19:58.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  2. #2
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,184
    +1

  3. #3
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,184
    Two questions:

    1) is there documentation on NetworkRequest on the wiki? If so, I can't find it.

    2) will it handle sftp?

    thanks,

    Hank

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,159
    Blog Entries
    22
    Hi Hank,

    1. It is documented on this thread. That mentions all the class members. It looks like it has not yet been added to the doc wiki.
    2. No. http, https and ftp only.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  5. #5

  6. #6
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,184
    Hi Yvonne,

    The doc makes no mention of https (which I assume it handles) and ftp (which I'm not sure about now).

    thanks,

    Hank

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us