Hello,
I use DataTable editor with c#.NET library.
One on my fields it's "upload" type.
I don't want save the file in disk, I want directly save content in my DB.
What's method for this ?
This code save content on my DB and on my disk :
var response = new Editor(db, "users")
.Model<UploadModel>()
.TryCatch(false)
.Field(new Field("image")
.SetFormatter(Format.IfEmpty(null))
.Upload(new Upload(request.PhysicalApplicationPath + @"uploads\__ID____EXTN__")
.Db("files", "id", new Dictionary<string, object>
{
{"web_path", Upload.DbType.WebPath},
{"system_path", Upload.DbType.SystemPath},
{"filename", Upload.DbType.FileName},
{"filesize", Upload.DbType.FileSize},
{"content", Upload.DbType.ContentBinary},
})
.DbClean(data =>
{
foreach (var row in data)
{
// Do something;
}
return true;
})
.Validator(Validation.FileSize(500000, "Max file size is 500K."))
.Validator(Validation.FileExtensions( new [] {"jpg", "png", "gif"}, "Please upload an image."))
)
)
.Process(request)
.Data();
I try Upload(null) by don't work.
Thanks,