File upload size limit in IIS

Yay file uploads. As if letting the users to type in stuff into the web application giving me SQL injection nightmares weren’t enough, now I have to let users upload files.

Peachy.

So during my investigations into the limits of file uploading, I found that I couldn’t upload a file more than 30MB on my test server. It failed faster than Superman could jump a building in a single bound, and with just as much sound.

In short, here are my findings. The default file size limit set in IIS (6 and below? Read on for more details) is 4MB. In IIS7 (on Windows Server 2008), the file size limit is 30MB (technically it’s 28.61MB because it’s 30000000 bytes but who’s keeping track. Hey you read on!).

So how do you change the limits? In the web.config file. We’re doing ASP.NET applications.

<httpRuntime executionTimeout="3600" maxRequestLength="20480" />

That will give you a timeout period of 1 hour (3600 seconds) and a file size limit of 20MB (20480 KB. Yes, that attribute is in kilobytes).

For IIS7, we do this:

<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="134217728" />
    </requestFiltering>
</security>

That gives you a 128MB limit (128 * 1024 * 1024). Yes it’s in number of bytes.

So why was I doing file uploads? Documents from university staff or students. The most important of which is the final doctoral thesis.

I asked how large can that thesis be, assuming it’s in PDF form. I got an answer where a 40MB limit seems too small. Really?

I had trouble auto-generating an Excel file of 40MB just to test the server limits. Do you know how large 40MB is?

If it’s a video or sound file, then yes I can believe it. I have video files of over 100MB, some over 200MB. But a PDF? With mostly text?

Go check out the Open XML specs from ECMA. The largest document is about 28MB. It’s over 5000 pages. I doubt any thesis can match that number of pages.

Compression and space

Back when I was in my making games mode years ago, I was interested in space. Specifically data storage.

Blitting images to the screen as quickly as possible to keep the frame rate consistent was a thing. Texture images are pre-created. Then there’s the concept of generating textures as the program was executed. This was how demos pack data into a small space.

I was studying fractals then, the iterated function system was a thing. I found it a pain to implement though…

And then I was interested in having moving images in my game engine. Packing movies was way harder than images.

Due to the copyrights of all the video formats, in my infinite wisdom, I decided to create my own. I mean, it’s a series of images, right?

The resulting customised movie file was just slightly larger in size than the QuickTime .mov format. I took that as an encouragement. I’ll tell you what I did next time.

Magazine publishing part 1 – Fonts

With a few issues of my magazine published already, I feel confident enough to write about the process. In my free ebook (which you can get by subscribing to Singularity. Sign up at the blog), I told you to use only 2 different fonts in your magazine, 3 at most. The truth is, you can use as many fonts as you like. It’s your magazine. However, I told you to select only 2 or 3 fonts because I don’t want you to be paralysed by choice. I’m going to teach you more about font selection here.

4 broad categories of fonts

Fonts can generally be categorised into the following:

  • Serif fonts
  • Sans serif fonts
  • Fixed width fonts
  • Fancy fonts

Serif fonts have decorative features on the characters. “Times New Roman”, “Georgia” and “Cambria” are serif fonts.

Sans serif fonts don’t have those decorative features (“sans” means “without”). “Arial”, “Helvetica” and “Calibri” are sans serif fonts.

Fixed width fonts have, well, fixed widths for each character. This is especially useful to programmers because it makes code easier to read. “Courier New”, “Lucida Console” and “Consolas” are fixed width fonts.

Fancy fonts are designed for decorative purposes. “Chiller”, “Jokerman” and “Vivaldi” are fancy fonts.

Fancy font examples

Design for contrast

When designing for a web page, the conventional advice is to use a serif font for headings and a sans serif font for text. This is because sans serif fonts are easier to read on the screen, because they lack the decorative features which can crowd the pixels and make it hard to read. A serif font is used for the headings to provide contrast.

In physical print, it’s the opposite. That’s because a newspaper or a book has infinite resolution, so serif fonts work well. Those decorative features make it easier for a reader to quickly identify characters and thus it’s easier to read.

As for fonts in an online magazine, it’s meant to be read on the screen, so in general, design for that. However, a magazine is not a web page. Be creative. Use whatever font you feel suits the content. Use a font for emphasis, for decoration, for subtlety, for telling your story.

Size matters

I look at a computer screen a lot. So I appreciate larger font sizes so I don’t have to squint. For this reason, I decided on larger font sizes wherever it made sense. This might make even more sense because mobile devices can also read my magazine. Designing a magazine for mobile devices is a separate article altogether, since we might have to design for dynamic text and image flow while still retaining the look of the original article in the magazine (or even the magazine itself).

But feel free to experiment on font sizes for other types of texts. Blow up heading text for emphasis. Enlarge pull quotes. Dwarf answers to quizzes. Write fine print. Design for the screen, but deviate for design.

The fonts I currently use

I use “Perpetua” for the Singularity title on the cover page. Can’t remember which book I saw this on, but the font used was on the copyright page of the book (yes, I read that page too. I’m curious, ok?). Sometimes, publishers print the font in which the text is set on. I tried “Perpetua” with the text “Singularity”, and it looked great. Stately with decorum, yet not too formal. So that stuck.

Magazine text was originally set in “Calibri”, the default font in Microsoft Word (I’ll tell you about the tools I use another time). Now I use “Corbel” because it renders the text better for easier reading (to me at least).

On the front cover, I use “Candara” for supporting text. No special reason other than I wanted to try a different sans serif font than the magazine text font. It also looked great, so that stuck as well.

Here are some interesting fonts during my experiments:
Font suggestions

  • Castellar – Automatically in small caps. Great for decorative text
  • Copperplate Gothic – Also in small caps. Reminds me of Gotham City…
  • Edwardian Script – Alternative to the Vivaldi script
  • Elephant – If you want emphasis, get one of the largest land animals as a mascot
  • Harrington – Reminds me of book stores…
  • Palatino Linotype – Good-looking serif font. Consider using it for headings
  • Papyrus – For when you need writing that looks like it was written on old paper
  • Rockwell – For a feeling of solidarity

Ok, that’s it. If there’s anything you want to know, please comment.