Saving file mime type in database using php/mysql -
i save file path in database title , short description
id file title desctiption date
here, want filter table file type
best method should use?
method 1 : save file extension in new field
method 2 : save file mime type in new field
method 3 : using mysql search in file name in current file field "%.jpg"
i think wordpress uses method 2 , stores attachment mine type in posts table
, sorry bad english
i'd suggest use mime types. unique known types, , since put them in different column, database can efficient handle queries on mime type. string comparision queries like *.jpg
can slower.
if use-case involves querying on file extensions, i'd suggest go method 1.
Comments
Post a Comment