Register file extensions / mime types in Linux

Use xdg-utils from freedesktop.org Portland. Register the icon for the MIME type: xdg-icon-resource install –context mimetypes –size 48 myicon-file-type.png x-application-mytype Create a configuration file (freedesktop Shared MIME documentation): <?xml version=”1.0″?> <mime-info xmlns=”http://www.freedesktop.org/standards/shared-mime-info”> <mime-type type=”application/x-mytype”> <comment>A witty comment</comment> <comment xml:lang=”it”>Uno Commento</comment> <glob pattern=”*.myapp”/> </mime-type> </mime-info> Install the configuration file: xdg-mime install mytype-mime.xml This gets your files … Read more

Where does Windows store its “Open With” settings?

Take a look in: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\ and the sub-key of that is the extension you reassigned. Under that there will be the UserChoice and OpenWithList sub-keys which will contain your redefinition. You may also want to read http://support.microsoft.com/kb/950505 which talks about your issue. Update As of Windows 8, life has gotten far more complicated. To create … Read more

s3 direct upload restricting file size and type

If you are talking about security problem (people uploading huge file to your bucket), yes, You CAN restrict file size with browser-based upload to S3. Here is an example of the “policy” variable, where “content-length-range” is the key point. “expiration”: “‘.date(‘Y-m-d\TG:i:s\Z’, time()+10).'”, “conditions”: [ {“bucket”: “xxx”}, {“acl”: “public-read”}, [“starts-with”,”xxx”,””], {“success_action_redirect”: “xxx”}, [“starts-with”, “$Content-Type”, “image/jpeg”], [“content-length-range”, … Read more

How to associate application with existing file types using WiX installer?

Here’s a full, complete example with a bit more detail and cleaner code than in the linked question and should provide a better answer. Quite timely as I’ve recently finished porting the code posted previously, to use proper ProgId elements so this is fresh in my mind 😉 In regards to the ‘what here’, you … Read more

How to get file name from content-disposition

Here is how I used it sometime back. I’m assuming you are providing the attachment as a server response. I set the response header like this from my REST service response.setHeader(“Content-Disposition”, “attachment;filename=XYZ.csv”); function(response, status, xhr){ var filename = “”; var disposition = xhr.getResponseHeader(‘Content-Disposition’); if (disposition && disposition.indexOf(‘attachment’) !== -1) { var filenameRegex = /filename[^;=\n]*=(([‘”]).*?\2|[^;\n]*)/; var … Read more

php file upload, how to restrict file upload type

The below just uses the mime types to validate a file, then checks the size of both. For a list of most mime types see here or google. function allowed_file(){ //Add the allowed mime-type files to an ‘allowed’ array $allowed = array(‘application/doc’, ‘application/pdf’, ‘another/type’); //Check uploaded file type is in the above array (therefore valid) … Read more

What are the Google Apps MIME Types in Google Docs and Google Drive?

Google Docs: application/vnd.google-apps.document application/vnd.google-apps.kix Google Presentations: application/vnd.google-apps.presentation Google Spreadsheets: application/vnd.google-apps.spreadsheet Google Drawing: application/vnd.google-apps.drawing See here for more information. Here is a long list of Google Docs and Google Drive MIME types (it is not exhaustive): application/vnd.google-apps.audio application/vnd.google-apps.document application/vnd.google-apps.drawing application/vnd.google-apps.file application/vnd.google-apps.folder application/vnd.google-apps.form application/vnd.google-apps.fusiontable application/vnd.google-apps.kix application/vnd.google-apps.photo application/vnd.google-apps.presentation application/vnd.google-apps.script application/vnd.google-apps.sites application/vnd.google-apps.spreadsheet application/vnd.google-apps.unknown application/vnd.google-apps.video