Created
January 11, 2018 00:10
-
-
Save dcomartin/4af5e91f4fe0aa0235544b99ad7bffd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Upload a file from file system | |
db.FileStorage.Upload("$/photos/2014/picture-01.jpg", @"C:\Temp\picture-01.jpg"); | |
// Upload a file from a Stream | |
db.FileStorage.Upload("$/photos/2014/picture-01.jpg", "picture-01.jpg", stream); | |
// Find file reference only - returns null if not found | |
LiteFileInfo file = db.FileStorage.FindById("$/photos/2014/picture-01.jpg"); | |
// Now, load binary data and save to file system | |
file.SaveAs(@"C:\Temp\new-picture.jpg"); | |
// Or get binary data as Stream and copy to another Stream | |
file.CopyTo(Response.OutputStream); | |
// Find all files references in a "directory" | |
var files = db.FileStorage.Find("$/photos/2014/"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment