How do I create a mime type for a .cbz file?

I'm trying to open .cbz files on my website but I keep getting an

Page 1 of 1

3 Replies - 6243 Views - Last Post: 27 September 2009 - 09:49 AM

#1 kennygulag  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 26-September 09

How do I create a mime type for a .cbz file?

Post icon  Posted 26 September 2009 - 11:53 AM

[font=Microsoft Sans Serif]
Hey there, I'm trying to get my personal (my eyes only) website off the ground and I'm having a problem with the website when it comes to opening the .cbz files which are uploaded to the GoDaddy server. I've contacted GoDaddy for support but they have told me that in order for the .cbz files to open (.cbz files are actually Comic Book reader files) I'll have to add a mime type to a web.config file. I've looked on the web for help but none seems to be available for this type (.cbz) of file. I don't know where to start. Could someone please help with a nudge or whack in the right direction? Thanks in advance for any help

Is This A Good Question/Topic? 0
  • +

Replies To: How do I create a mime type for a .cbz file?

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4332
  • View blog
  • Posts: 12,127
  • Joined: 18-April 07

Re: How do I create a mime type for a .cbz file?

Posted 26 September 2009 - 12:17 PM

A web.cofig file is a simple XML file that tells your server (or in the case of Go Daddy) how to configure your website. It is a very simple file that you can create using notepad. It looks like the following...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>

  </system.web>
</configuration>



This is a bare minimum web config. As you can see, it has a configuration and in that a system.web set of tags. In between these tags you can place various settings for configuring your site. This is where you are going to add your mime types.

Here we add a simple mime type for your CBZ file and tell it two pieces of information. One is the file extension... CBZ and the second is the type of mime it is...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
		<staticContent>
			<mimeMap fileExtension=".cbz" mimeType="application/x-cbz" />
		</staticContent>
  </system.web>
</configuration>



Save the file as web.config and then place it into your web root directory (if one is not already there... if it is already there, edit that file instead so you don't lose any of GoDaddy settings). Ideally this should work on IIS 7. If it doesn't work, contact GoDaddy. Also make sure that GoDaddy doesn't already provide a feature in the control panel to access your web.config. They may have one (I can't be sure I don't use that host) and if they do, edit the web.config through there.

Either way, you should be looking to add the mimeMap element there to the web.config for staticContent.

Hope this helps!

"At DIC we be web.config configuring code ninjas.... kinda tricky to say as well as type!" :snap:
Was This Post Helpful? 0
  • +
  • -

#3 kennygulag  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 26-September 09

Re: How do I create a mime type for a .cbz file?

Posted 26 September 2009 - 08:37 PM

Thanks for getting me going. I copied and pasted your code to a new web.config file and placed it in the root of my site.
The root looks like this now. Now I receive error message 500 (see below). I'm just wondering if there is any other coding I'm missing that should be in the web.config file.

/
_db_backups
digital_comics
stats
index.html
web.config
welcome.html

Now when I go to my site I receive a "500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed." Once again, thanks in advance.

This post has been edited by kennygulag: 27 September 2009 - 09:00 AM

Was This Post Helpful? 0
  • +
  • -

#4 kennygulag  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 26-September 09

Re: How do I create a mime type for a .cbz file?

Posted 27 September 2009 - 09:49 AM

I don't know how I did it, but I did it. Thanks to Martyr2 for helping to get me started in the right direction. I believe I googled "how to code a web.config file for godaddy" and I came across (http://blogs.iis.net/bills/archive/2008/03/23/how-to-un-block-directories-with-iis7-web-config.aspx) this page on security and I kind of mixed the two ideas together and...magic: my .cbz files now open. Here's how:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<system.webServer>
		<staticContent>
			<mimeMap fileExtension=".cbz" mimeType="application/x-cbz" />
		</staticContent>
		<security>
			<requestFiltering>
				<hiddenSegments>
					<remove segment="cbz" />
				</hiddenSegments>
			</requestFiltering>
		</security>
	</system.webServer>
</configuration> 



I'm sorry to say I do not have any idea of what the coding means...needless to say I'm a total d.i.c. head!

Again thanks to Martyr2 and BillS IIS Blog for examples. Hope it will help someone out in the future.
Was This Post Helpful? 1

Page 1 of 1