I have been struggling put restriction for uploading video to upload only mp4 videos in media module, other media content like image etc. can be uploaded, but I need to put restriction for video type alone.

I am newbie in Drupal, can some one help me in this, what are the places I need to change in media module.

While Adding File

Restrict video upload to mp4 only

don't want other video format, only mp4

I would really appreciate any help on this. I did found sites\all\modules\media\includes\media.pages.inc file which had a function media_add_upload_validate($form, &$form_state) also then I found sites\all\modules\media\includes\media.variables.inc which had function media_variable_default and media_variable_get. Then I got lost. I am not sure if these are the correct files where I need to make the changes. Also I was wondering if I have to make change in Drupal core module to do the video upload restriction to mp4 perfectly.


  • Thanks for whoever has up-voted this question to encourage me :)
    – Hitesh
    Commented Feb 12, 2014 at 11:05
  • @Ajit Thanks for editing, really sorry for errors in asking question.
    – Hitesh
    Commented Feb 12, 2014 at 11:06
  • No need to apologize. We all make mistakes ;-)
    – AjitS
    Commented Feb 12, 2014 at 12:00

1 Answer 1


Go to admin/config/media/browser to change settings.

enter image description here

  • WOW :D ur awesome @Anil Sagar !!!! just one quick question will this modification be reflect in all the places or do i have to some other place as well, to make sure upload and error messages are changed correctly
    – Hitesh
    Commented Feb 12, 2014 at 9:59
  • What do you mean by all places ?
    – Anil Sagar
    Commented Feb 12, 2014 at 10:02
  • by all places i mean all the error messages which are displayed when i tried to upload other files like flv or mpeg?? Just wanted to make sure making change in this place is enough. Thank you so much for quick reply
    – Hitesh
    Commented Feb 12, 2014 at 10:06
  • Yes, It's taken care by the module... The error messages that you see are rendered from a template..
    – Anil Sagar
    Commented Feb 12, 2014 at 10:07
  • It is working great but it is taking time to show error, It is waiting for file to get uploaded and only after that it shows the error is there any way to show the error before file gets uploaded.
    – Hitesh
    Commented Feb 17, 2014 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.