Mediaservice: file path. How change it for files uploaded by members?
Hi,
I created a reserved area for some members. So them must be upload some docs. I wish to upload out media folder.
I'm able to upload and save them out media folder, but how to show the link to docs into backoffice into an upload doctype? Is there a link datatype where I put in the file url ?
if (model.DocumentoFile_1!= null && model.DocumentoFile_1.ContentLength > 0)
{
// Do the necessary to save the file and attach it to the member property
var fileName = Path.GetFileName(model.DocumentoFile_1.FileName);
var path = Path.Combine(Server.MapPath("~/DocumentiPratiche/"), fileName);
model.DocumentoFile_1.SaveAs(path);
var mediaService = Services.MediaService;
//CreateMedia takes the name of the media you are created, the id of the parent and finally the alias of the MediaType that you want the media to be based on.
var media = mediaService.CreateMedia(model.DocumentoFile_1.FileName, -1, "File");
mediaService.Save(media);
media.SetValue("umbracoFile", model.DocumentoFile_1);
//And then save it similar to the above snippet
mediaService.Save(media);
newpratica.SetValue("documento1", media.GetValue("umbracoFile").ToString());
}
Mediaservice: file path. How change it for files uploaded by members?
Hi,
I created a reserved area for some members. So them must be upload some docs. I wish to upload out media folder. I'm able to upload and save them out media folder, but how to show the link to docs into backoffice into an upload doctype? Is there a link datatype where I put in the file url ?
is working on a reply...