Skip to content

Commit ef3897b

Browse files
committed
Add FilesUploadFeature
1 parent d9c598a commit ef3897b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Test/AppHost.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using ServiceStack.Configuration;
55
using ServiceStack.Data;
66
using ServiceStack.Host.Handlers;
7+
using ServiceStack.IO;
78
using ServiceStack.Logging;
89
using ServiceStack.NativeTypes.Java;
910
using ServiceStack.NativeTypes.TypeScript;
@@ -141,6 +142,22 @@ public override void Configure(Container container)
141142
});
142143

143144
TypeScriptGenerator.ReturnTypeAliases[typeof(byte[]).Name] = "Uint8Array";
145+
146+
var fileFs = new FileSystemVirtualFiles(HostingEnvironment.ContentRootPath.CombineWith("App_Data/files").AssertDir());
147+
Plugins.Add(new FilesUploadFeature(
148+
new UploadLocation("pub",
149+
fileFs,
150+
readAccessRole: RoleNames.AllowAnon,
151+
// requireApiKey: new(),
152+
maxFileBytes: 10 * 1024 * 1024,
153+
resolvePath:ctx => "pub".CombineWith(ctx.FileName)),
154+
new UploadLocation("secure",
155+
fileFs,
156+
// requireApiKey: new(),
157+
maxFileBytes: 10 * 1024 * 1024,
158+
resolvePath:ctx => "secure".CombineWith(ctx.FileName))
159+
));
160+
144161
}
145162

146163
private void CreateUser(OrmLiteAuthRepository authRepo,

0 commit comments

Comments
 (0)