On a few occasions now, I’ve been asked whether it’s possible for the Desktop Media Uploader for Umbraco package could be made to support custom folders, to which, unfortunatley, the current answer is no. Rather than explain the reasons why every time the question pops up, I just thought I’d write a quick blog post instead.

1. Umbraco media has no “Folder” concept
The first reason is that Umbraco doesn’t really have the concept of a “Folder”. In Umbraco Folders and Files are the same, they are all just Media Types with differing “allowed child media types”. Ok, so I could check all media types to see if they allow sub media types, but that leads me on to reason 2.

2. Desktop Media Uploads are created File first 
When uploading a file via Desktop Media Uploader, the server automatically works out what Media Type to create a media item based upon it’s extension. The problem with this is that that it’s not until the file is uploaded that you would be able to discover whether the file can actually be created in the desired location. By only supporting the “Folder” Media Type, we don’t have that problem, as the “Folder” type can handle all Media Types, or, if it can’t, we can be sure at a bare minimum it can support the “File” Media Type as a fall back. With a custom folder, it could be possible to have no fall back media type, leaving us no option to deny the upload and report an error.

3. Folders don’t exist
The final reason, and this is more to do with the actual uploading of folders, is the fact that folders don’t actually have any physical attributes to be able to discover how to handle them. With files, we can check the file extension, and decide how to handle it, but with folders, that’s not possible. Team this then with “File first” upload issue mentioned above, and you can really start to get into a mess. What if you upload a folder that is not allowed in that location? All files in that folder would fail, and it would require the user to then log in to the CMS and rectify the issue.

I’m pretty sure that these things may be possible to fix, but the point of Desktop Media Uploader has always been to suite the largest majority of Umbraco users, and to not over complicate the process. I have made it extendable by supporting custom Media Types for files, but in my honest opinion, supporting custom folders just isn’t worth the payoff.

That said, Desktop Media Uploader is an open source package, and users are more than welcome to look at implementing this themselves, and if anyone was to do this, I’d be more than happy to review the code and merge the changes in if feel they don’t compromise the current  functionality.

http://dmu4umb.codeplex.com/SourceControl/list/changesets

Happy uploading.

Having used Umbraco now for nearly 2 years, I tend to take for granted my core understanding of how the system really works. It’s only when helping out others do I realize that it’s not always that easy to grasp for someone new to the platform. My usual stock answers when someone asks how to get started is to point them to the training courses, the umbraco videos or just to get involved in the forums.

Today however, I was helping out a newcomer to Umbraco who asked what to me was a very fundamental question:

@mcDarke is there like a diagram that shows the architecture of umbraco..?

What a great question. Pretty much every Umbraco developer will have asked that question at some point, but yet the answer to his question was “no”. Rather than just just saying no though, and risking the loss of another potential member of the already awesome community, I thought I’d quickly draw one myself, so here it is, the anatomy of an Umbraco page.

Needless to say, it was exactly what he needed.

@mcDarke that is what I wanted basically…lol….THANKS….Umbraco guys are cool

It was only after it got retweeted several times though that I truly realized just how helpful the diagram is, so instead of just letting it get lost in the twittersphere, I thought it would be a good idea to create a blog post around it so that others might find it as they join the community.

I hope this goes some ways to explaining to newcomers what us Umbraco veterans take for granted. And if not, by all means leave a comment and I’ll see if I can improve it.

Update – April 7th, 2011 14:07

If you are after a diagram of the Umbraco database structure, then be sure to checkout Hendy Racher’s posts on the subject:

http://blog.hendyracher.co.uk/umbraco-database-part-1/
http://blog.hendyracher.co.uk/umbraco-database-part-2/

And there is also a really detailed database diagram by the guys at Sniper Systems over here:

http://snipersystems.co.nz/community/umbracodb.png

Update – April 8th, 2011 04:40

Whilst the aim of my diagram was to sum up the core concept of Umbraco as simply as possible, Jesper Hauge has done a nice job of creating a more thorough diagram of all the parts that make up a Document. So if you find my diagram lacking in any way, you may want to head over to his blog and take a look at his version. Nice work Jesper.

Update – June 7th, 2011 07:35

Thanks to Adam Shallcross over at The Cogworks, another version of my diagram has been made available. This one is available in .EPS & .PDF formats, and is a little more presentation friendly. You can grab a copy right here.

For a long time, whenever I’ve been developing a site, I would always set it up in IIS with a custom host header and modify my windows hosts file to wire it all up. I know a lot of developers don’t go to this extent, instead plumping to only run it via Visual Studio and Cassini. I’ve never been a fan of this way of working, mainly because I like to have access to my sites at all times, without having to launch Visual Studio (especially if I’m developing an Umbraco site, and all I need to do is update some CSS or something which I can do easily and quickly via the UI). The downside to setting sites up in IIS though, is that it does add extra steps to the beginning of a project, which can get tedious.

After reading a blog post by Aaron Powell, it got me thinking though. Why not use IIS Express to dynamically serve a directory as and when I need it? So with that, I knocked together a simple .vbs script you can drop in your “Send To” context menu folder (C:\Users\[YOUR_USERNAME]\AppData\Roaming\Microsoft\Windows\SendTo\), which will launch an IIS Express instance with it’s path attribute set to the “Sent” folders path, and it’s port attribute set to a random number between 1024 and 9999. The script will also then launch the generated URL in your default web browser. When you want to shutdown the web server, you can stop it using the IIS Express System Tray context menu.

If you’d like to try this yourself, just drop the following into a .vbs file and save it to your “Send To” folder.

' Init randomization
Randomize

' Set random port number
Dim port
port = Int(Rnd() * 8974) + 1025

' Launch IIS Express / Browser
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """%programfiles%\iis express\iisexpress"" /path:""" & WScript.Arguments.Item(0) & """ /port:" & CStr(port) & " /systray:true", 0, False
WshShell.Run "http://localhost:" & CStr(port), 9, False
Set WshShell = Nothing

UPDATE – March 15, 2011 12:25

As highlighted by Lee Kelleher in the comments, if you are using a 64bit OS, then please make sure to change %programfiles% to %programfiles(x86)%

Follow

Get every new post delivered to your Inbox.