Luke
07/05/2023, 3:05 PMMediaFileManager.FileSystem
to get to the filesystem to use FileExists and OpenFile etc.Janae
07/05/2023, 3:22 PMAnders Bjerner
07/05/2023, 4:10 PMMediaFileManager
. It has a FileSystem
property, which again has a OpenFile
method.
Eg.:
using Stream stream = _mediaFileManager.FileSystem.Open("/media/egpmoga4/froe.jpg");
Janae
07/05/2023, 4:13 PMAnders Bjerner
07/05/2023, 4:14 PMJanae
07/05/2023, 4:14 PMAnders Bjerner
07/05/2023, 4:15 PMJanae
07/05/2023, 4:17 PMLuke
07/06/2023, 7:06 AMMediaFileManager
as mentioned in the post but for some reason it doesn't want to open a stream to the fileLuke
07/06/2023, 7:07 AMLuke
07/06/2023, 8:37 AMvar fullOrgPath = _mediaFileManager.FileSystem.GetFullPath(_mediaFileManager.FileSystem.GetRelativePath(imagePath));
which returned a path without the / at the beginning, this turned out to be the issue. If I use the imagePath
variable which was just media.Url()
then I get a path with a leading / which does work!Anders Bjerner
07/06/2023, 10:36 AMOpenFile
method shouldn't be a full/absolute path, but the one you get from the umbracoFile
property or media.Url()
.Luke
07/06/2023, 12:02 PM