Spludlow Web Header

HTTP File Upload & Download


Built in HTTP Transfer

When your applications are running between multiple hosts you often need to move files between boxes.

You can just rely on the framework’s built in parameter encoding, for example call a method on a remote host with a byte[] parameter, then the data is automatically sent over the wire.

But there are times when you want to deal with files directly, within your methods.

The framework provides upload and download methods for transferring files over HTTP:

       Spludlow.Call.Upload("REM-HOST", @"C:\Here.dat", @"C:\There.dat");

 

       Spludlow.Call.Download("REM-HOST", @"C:\Iwant.dat", @"D:\Igot.dat");

There are several overloads with streams and byte[] rather than filenames that you can use.

All buffering is disabled in the Frameworks HTTP transfers as large files will hog memory.

Routing is automatically performed, for example: you are uploading to a host within the LAN on a remote network, the file will passed through a stream on the remote network’s “router” host.

HTTP POST (Upload) Size Limit

IIS will not allow you to HTTP POST more than 2 GB, however much you fiddle about with the configuration. I would not try to upload a file larger than 1.9 GB otherwise it will fall over.

HTTP Get (Download) on the other hand will serve up a file no matter how large it is.

So if your upload is blowing out then simply run a download from the other end.

Remote IO

The RemoteIO class also provides some readymade remote file-system operations.

Just a bunch of remote wrappers, for example:

       public static bool FileExists(string host, string path)

       {

              return (bool)Spludlow.Call.Now(host, "System", "System.IO.File", "Exists", new object[] { path });

}

 


 
 
 
 
 
 
 
 
 
Spludlow Web Footer