Note the following example are only compatible with v1.1.x
All samples are part of the download package (v_1.1)."Exposing a file from the store to the web"
protected void Page_Load(object sender, EventArgs e)
{
string fileIdentifierString = Request.QueryString["fileIdentifier"];
string fileStorage = Request.QueryString["fileStorage"];
if (!string.IsNullOrEmpty(fileIdentifierString) && !string.IsNullOrEmpty(fileStorage))
{
Guid uniqueIdentifier = new Guid(this.Request.QueryString["fileIdentifier"] as string);
FileStorageHandler FileStorageHandler = new FileStorageHandler(fileStorage);
Response.ContentType = "image/jpeg";
Response.Buffer = true;
Response.Clear();
byte[] bytes = FileStorageHandler.GetFileByteData(uniqueIdentifier);
Response.OutputStream.Write(bytes, 0, bytes.Length);
Response.OutputStream.Flush();
Response.End();
}
}
"Creating a new file storage in C#"
FileStorageHandler FileStorageHandler = new FileStorageHandler(containerName);
FileStorageHandler.Create(CreateFileStorageBehaviour.IgnoreWhenExists);
Console.WriteLine(FileStorageHandler.GetInfo());
"Storing a file from the web into the File Storage"
Guid uniqueIdentifier = Guid.NewGuid();
FileStorageHandler FileStorageHandler = new FileStorageHandler(containerName);
FileStorageHandler.StoreHttpRequest(uniqueIdentifier, "http://www.prijsvaneenhuis.nl/img/spandoek/NFileStorage_banner.jpg", "NFileStorage", AddFileBehaviour.ThrowExceptionWhenAlreadyExists);
"Dumping files from the File Storage to the file system"
FileStorageHandler FileStorageHandler = new FileStorageHandler(containerName);
List<Guid> fileIdentifiers = FileStorageHandler.GetAllFileIdentifiers();
foreach (Guid fileIdentifier in fileIdentifiers)
{
string outputFile = fileIdentifier + ".jpg";
Console.WriteLine(string.Format("Exporting {0}", outputFile));
FileStorageHandler.ExportToFile(fileIdentifier, outputFile, ExportFileBehaviour.SkipWhenAlreadyExists);
}