views:

76

answers:

4

I am working on a project that requires programmatically distributing a compressed file that in a format that is associated with my software. I am writing the software in Python.

I would use .zip, but I don't want to overwrite any previouse filetype associations. ( with zip utilities )

A: 

Use cryptography?

Santa
Any idea how to do that?
Zachary Brown
+4  A: 

You could create new file extension other than .zip and associate that file extension with your program.

S.Mark
I tried that, but on my server, when trying to download the file, it just opens up a browser with what I guess is the encoding? Here it is:iquiz.zbrowntechnology.com/Test.ibza
Zachary Brown
Its because Content-Encoding on your response header is `text/plain`. change it to application/something, browser will popup you to download or open (if you choose open from browser, OS/browser will let you choose application to open it, then set your application, browser will remember that file association infos later on)
S.Mark
How do I change it? The filetype is associated on the os. I used the Python module zipfile to zip it, what now?
Zachary Brown
@Zachary, put .htaccess file in web server, and put `<FilesMatch "\.ibza$">` `ForceType "application/something"` `</FilesMatch>`
S.Mark
A: 

Do what Java does: use zip format[*] file, but use a different filename extension.

[*] or a standard compression format of your choosing.

Edmund
Oh, I think I got it. I could use the zip format, just change the extension ( as you guys suggested ), but include the file in a self extracting zip archive that executes the file after download!
Zachary Brown
A: 

If you are looking to be able to associate an extension with your application, just use your own unique file extension and leverage existing zip processes.

If you are looking to be able to ensure that your own application is the ONLY application that can read the file as well, even if the user changed the extension you will have to do a LOT more work.

Mitchel Sellers