Images saved via mediaservice in console app end up in wrong place
Hi,
I am now able to use the mediaservice through a console application. I am using Umbraco.Core.Models to access the correct overload of Media.SetValue. One problem that is stopping this working at all, is that the images are being saved into the bin directory of the console application with completely inappropriate folder name. For example, a new image is saved to bin/Debug/media/1004.
I have an idea that I may need to tweak the FileSystemProviders.config file in the console application so that new images get placed in the Umbraco website. Say
replacing the virtual root with the absolute address of the umbraco website media folder. Would that be enough to get the new direcoty named with the id of the new IMedia object?
Images saved via mediaservice in console app end up in wrong place
Hi,
I am now able to use the mediaservice through a console application. I am using Umbraco.Core.Models to access the correct overload of Media.SetValue. One problem that is stopping this working at all, is that the images are being saved into the bin directory of the console application with completely inappropriate folder name. For example, a new image is saved to bin/Debug/media/1004.
I have an idea that I may need to tweak the FileSystemProviders.config file in the console application so that new images get placed in the Umbraco website. Say
<Provider alias="media" type="Umbraco.Core.IO.PhysicalFileSystem, Umbraco.Core">
<Parameters>
<add key="virtualRoot" value="~/media/" />
</Parameters>
</Provider>
replacing the virtual root with the absolute address of the umbraco website media folder. Would that be enough to get the new direcoty named with the id of the new IMedia object?
I tried replacing the virtual path by an absolute path but that lead to a TargetInvocationException
The virtualRoot argument must be a virtual path and start with '~/'
"C://Websites/UmbracoSites/ElyRunners_2015/ElyRunners/ElyRunners/media/" isn't virtual, of course. Not sure where to go now.
The provider allows you to configure the root as a UNC path:
Grtz
L
Lennart,
I was already on it but thatnk you so much for your support. I followed http://www.proworks.com/blog/2013/07/31/how-to-redirect-the-umbraco-media-path-to-another-location/ and I did also need a rootUrl, as that overload of PhysicalFilePath needs two arguments. I just set this to "/media/". I now have a fully functional test image. At least I haven't put it in a page yet but that is a detail!
is working on a reply...