dev.uploadfile

The 10gen appserver includes a small utility to upload files into GridFS the 10gen grid filesystem.

This file is found in bin/scripts. When run without arguments, it will show usage information :

$ bin/scripts/uploadfile

usage :  dbURL  file[:alias]*  [ file[:alias]* ...]
where :
         dbURL : database to insert file(s) into.  Composed as [host/]database, where
                 optional host defaults to localhost

         file[:alias]* : file to upload, with one or more optional aliases

  example : uploadfile  localhost/admin   myfile.tgz:stable.tgz:foo

Although straightforward, a few things warrant comment.

dbURL

The dbURL is a composition of an optional database machine FQDN and a database name. For example, to specify the database "woogie" on your local machine, the following are all equivalent :

woogie
localhost/woogie
127.0.0.1/woogie

for a machine mydbserver.mydomain.com :

mydbserver.mydomain.com/woogie

alias

An alias is like a tag or link to a file in GridFS, with the feature that the object with the newest timestamp for a given alias will be returned to the caller. For example, the SDK page on the wiki has links like :

   http://www.10gen.com/~~/f/10gen-linux_x86_64-stable.tar.gz

where 10gen-linux_x86_64-stable.tar.gz' is actually just an alias for the current version of the stable SDK for 64-bit linux. Whenever we create a new build, we upload the file under the true, unique filename, and attach the above alias.

A file can have zero, one or more alias's associated with it.