This is a re-post and partial rewrite of a blog article I wrote back in 2010. Yeah. That was 12 years ago, and the post is not only still relevant, I'm rewriting it because of a question in the official DNN community forum last week. Oh, and I won't even mention that DNN just had it's 20th anniversary! I mean, wow!!
Every once in a while, when introducing someone to DNN or when answering a forum post about DNN, I find a question that should be far easier to answer. I don't mean easier, in that something is wrong. It's for a completely different reason... It doesn't make sense at first to someone who hasn't yet used a platform (or at least not in this way).
When you're building and maintaining websites where you're the only developer, things are very tangibly tied together. Your updates primarily consist of using FTP to deploy them. When this is the case, you most likely will come to DNN (and any other platform) feeling that the files are somehow missing, in the wrong place, or simply in a magical location that you just deal with.
Simply put, you see your file, but you don't know what the path is to reference it. It makes no sense, right?
It's okay. You're not the only one. We've all been there at some point. This article should help make this all feel much more comfortable.
What's to follow is a genericized version of a common scenario...
An end-user has suddenly become very upset after attempting to upload and use files in DNN. They uploaded an image using a file manager, and then couldn’t find the image. They assumed that since they uploaded the image to the what appeared to be the “root” folder. If they're HTML-savvy, they might have even tried guessing the file path for the image in the HTML source view, but no luck!
One might think that the image would be in the root of the website. Well, even though that might make sense normally, that’s not how platforms like DNN host images.
What is the File's Path/URL?
As you can see above, the images are in the “Portal Root,” but what does that mean? To some people, they might not even know what a “portal” is, or they might have their own definition for the term. Keeping that in mind, it's very likely that many people will also misinterpret where the images physically live on the web server. In this case, here is the kind of URL being used to try to access an image file in the “Portal Root” of their website:
They will immediately be met with an HTTP 404 File Not Found error, though. That’s because the portal root is actually deeper in the website folder hierarchy. That same image will actually need to be referenced using a URL that looks more like the following example:
Replace the # symbol above with the PortalID of the website (portal) in question.
But Why, Will...? Why?
Why is that? Simple. DNN can and very often does host multiple websites from a single hosting account. That’s done for a variety of reasons, usually unique to each person(s) managing the website.
Since we wouldn’t want each portal (website) to share the same files uploaded by their own users (usually), they need to have their own “sandbox” to play in. This is for both security reasons, and to prevent files from being accessed or overwritten by other website users.
You Don't Need to Know the URL/Path
While that seems like a pain, DNN does a great job of making those files easy to access. Most of you will never need to know what the file path is. For example, most modules use a control that allows you to select files directly from your own portals directory. They might look a tiny bit different from module to module, but they all do the same thing.
Other modules that use the text editor make this even easier if you’re looking for images. The default WYSISYG editor has a browser to help you find images.
Once you click on the images button in the toolbar, there will be a “Browse Server” button in the resulting dialog that allows you to see the images loaded in your portals directory. You can even upload images and create folders from this dialog too!
I hope this helps clears up any issues for some of you out there. Let me know if there are any other issues that you’re facing with DNN. I’d love to help you!