How to get media file information?

Jignesh Patel asked on November 26, 2015 11:36

Hi,

I have field which is


Name: ProdImage

Date Type: text

Form Control: Media Selection


If I need to know media file information, how can I do that?

For an example if I want to know what is a size of the file? is that a image file? if image file than what is height and width of the image? etc...

Please let me know if you need more details or I am not explaining properly.

Thanks

Recent Answers


Roman Hutnyk answered on November 26, 2015 21:43

Having media file URL you should be able to get its info with following code: MediaFileInfo updateFile = MediaFileInfoProvider.GetMediaFileInfo(SiteContext.CurrentSiteName, "MyNewFolder/MyNewFile.gif", null);

0 votesVote for this answer Mark as a Correct answer

Jignesh Patel answered on November 27, 2015 01:54

Hi Roman,

Thank you for your help but I do have "/MyMediaFiles/media/MyMedia/Products/img-210x830.png?ext=.png" as field value. How can I do that?

Thanks

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.