I want to know how to get the file type (jpg, gif, doc, pdf, xls and others) of a file i am going to insert into a media field. To insert I use the following method.
media_content = application.readFile(media_file_path)
Also when I try to show an image in a media field where the file size is around 1.5mb then the system is crashed. Is it not recommended to show the file of that size or bigger?
I could not reproduce this problem with a 2MB file. I will send you a sample solution when I get the problem again. But I would like know how to get the type of the file. Could you please show how to do it?
You have to store the type of file (read it from the path) and store it yourself in the database. Here’s currently no way to automatically “tell” what kind of binary is stored in a media column. This is because you can store ANY binary data in a media field (Word documents, spreadsheets, databases, whatever).