I'm making a custom form and I want it to be able to upload .pem files. All things I find in google don't work. I already added it into the 2 arrays of file.mimetypes.inc:

1000 => 'certificate/pem',
'pem' => 1000,

But I don't know where to edit the other info to make it possible to upload it. A lot of sites say you have to edit in in content-type but this is a form which is in a module.

I got this as $form item.

$form['public_file'] = array(
'#type' => 'file',
'#title' => t('iOS Certificate File'),
'#description' => t('Upload your iOS certificate file here.'),
'#weight' => 35,

And this in the submission handler.

$file = file_save_upload('public_file', array(), 'public://');
if ($file) {
drupal_set_message(t('Thank you for uploading private file. You can download it from @url',
        array('@url' => file_create_url($file->uri))));

I want to place message1 in front of public_file in $form. How can I call this in the submit function?

  • First part is fixed now.. Still need to know the second question Commented Apr 20, 2015 at 15:15


Browse other questions tagged or ask your own question.