I have a file url like "http://localhost:49821/getmedia/8de48361-f3f3-4c9b-a4d4-140bf5d438cb/img1".but when I write the code to download through api-
byte[] fileBytes = System.IO.File.ReadAllBytes(path);
I got the error: "An exception of type 'System.ArgumentException' occurred in mscorlib.dll but was not handled in user code Additional information: URI formats are not supported."
Please help me to solve the issues.
The error message is quite clear in that you are using a URI to try and read the local file. Instead you need to get the location of the actual file. I am not sure which method you would use since the URL you posted indicates that it is coming from a Media Library.
Thanks Suneel for your reply.this is my code from where i got the url from medialibrary
Just get the bytes using the mediafileinfoprovider:
mfi = MediaFileInfoProvider.GetMediaFileInfo(mediafileGuid, CurrentSiteName); var bytes = mfi.FileBinary;
Please, sign in to be able to submit a new answer.