tags:

views:

98

answers:

2

I am writing a client windows app which will allow files and respective metadata to be uploaded to a server. For example gear.stl (original file) and gear.stl.xml (metadata). I am trying to figure out the correct protcol to use to transfer the files.

I was thinking about using ftp since it is widely used and a proven method to transfer files, except that I would have to transfer 2 files for every actual file (.stl and .stl.xml). However, another thought had also crossed my mind ... What if I create an object and wrap the file, metadata and the directory I needed to tranfer it to, serialize the object and then submit a request to a webservice, to transfer the file.

Original file size would range from 100k to 10MB. Metadata size would probably be less than 200k

The webservice call seems like an easier process to me to deserialize the object and distribute the file and respective metadata accordingly. However I'm not sure if this is a sound idea or if there is a better way to transfer this data other than the two methods I have mentioned.

If someone can point me in the right direction it would be much appreciated.

A: 

You could wrap it in a zip file like the "new" office document format does. You might even be able to use their classes to package it all up.

Edit:

Take a look at the System.IO.Packaging.Package class. It seems to be what you need. This class resides in the WindowsBase.dll assembly and became available in .NET 3.0.

PS: Remeber that even though it is a zip file it doesn't need to be compressed. If you have very large files it may be better to keep them uncompressed but it all depends on how theyre going to be used and if the transport size is an issue.

JohannesH
A: 

When would it be advantageous not to zip up a file to transfer it? Obviously different files compress differently and take varying amounts of time to do so, but generally speaking wouldn't you want to compress the file for transfer?

Joe
Usually the web server does the job of compressing files when they're being transferred so zipping the file up beforehand would *almost* have no effect on transfer compression. However, depending on your scenario this might not be the best solution, especially on a site with many users.
JohannesH
See: http://en.wikipedia.org/wiki/HTTP_compression
JohannesH