2

I have a .mobileconfig file in one URL. I am sending the Http post from xcode(When a button is clicked), the http post contains the .mobileconfig url. Can i download that file when the button is clicked ?

Cyril
  • 1,216
  • 3
  • 19
  • 40

2 Answers2

6

When it comes to serving up this file. It needs to be served up with a MIME Content-Type of application/x-apple-aspen-config. You may be able to do this by adding a line to your server's configuration or .htaccess file in the folder with:

<IfModule mod_mime.c>
    AddType application/x-apple-aspen-config .mobileconfig
</IfModule>

If serving the file from within PHP, you may do something like:

header('Content-type: application/x-apple-aspen-config; charset=utf-8');
header('Content-Disposition: attachment; filename="company.mobileconfig"');
echo $mobileconfig;
Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121
dbrajkovic
  • 3,693
  • 1
  • 17
  • 14
  • No no. From iPhone have you accessed/downloaded the .mobileconfig file from the browser ? When you access the link, it will open in a seperate window to install it. Likewise, i have given the link in the app, but it is not opening like browser nor it is not opening anything. My question is how to open through the application? – Cyril Feb 24 '12 at 06:49
  • charset is misspelled as chatset - I tried to edit but SO keeps complaining about the edit size being less than 6 chars long. – dazito Jun 29 '16 at 10:13
  • Thank you! Adding 'application/x-apple-aspen-config' as mime type did it for me. – CamHart Sep 29 '20 at 17:03
0

Small correction: that is not "chatset", it is Charset. Be sure which charset you want:

header('Content-type: application/x-apple-aspen-config; Charset=utf-8');
header('Content-Disposition: attachment; filename="company.mobileconfig"');
echo $mobileconfig;
ApproachingDarknessFish
  • 14,133
  • 7
  • 40
  • 79
sample
  • 1