Last post Feb 21, 2006 03:28 PM by mikeh36
Feb 20, 2006 04:34 PM|tinky_lou|LINK
I installed the Repository module on our public website, and we happily went along and loaded hundreds of docs. We used to have a simple asp app that listed all these documents using a file directory structure.
I just recently discovered that there's another app with a view out there, of the same folders, that I need to retain. This is an asp app that I can't "DNN-ify".
So ... I want to modify the asp app to read from the Repository's database structure to display its data.
So far, so good, I got the display from selected categories working, but ran into a problem with the timestamp the Repository adds. The filename in the db and the actual filename are not the same.
A sample filename from the db would be
And the physical file may be
I'm looking at the source code - downloader.aspx.vb and I can see that it strips off the extension, and then works from the first fullstop - so it seems to reconstruct to W0002147_003.pdf --> can't really see how this is useful though.
It's been suggested that I just use the W0002147, and search for the first file that matches this name, but if a user uploads the same doc more than once, I could end up displaying the wrong doc.
Can anyone shed some light on this for me, please?
Feb 21, 2006 06:21 AM|leupold|LINK
Feb 21, 2006 10:59 AM|mikeh36|LINK
A couple of reasons why the filename is changed.
1. Security - prevents direct linking to the files or people guessing what the filename is and getting around security permissions.
2. For the exact reason you mentioned about a user uploading the same doc more than once.
What the Repository does when you upload a file is it changes the name of the file to the same as what you're seeing in the db. Then when a user downloads it it strips that information out of the file before it goes to the user. I don't know if it's possible
for you to do it in your ASP file or not but perhaps you can apply the same logic (stripping out the extra info) before the filenames are displayed.
Feb 21, 2006 02:29 PM|tinky_lou|LINK
(I've posted my question on DNN forum also, it's awaiting moderation).
Thanks for the input.
The thing is ... the filename in the db does not appear to be the same as the physical filename. I've uploaded specific files and then checked what is added to the database ... they don't match!
The Repository doesn't link to the document, it uses a function called "DownloadFile", which calls "StreamFile" with the full path as per database, and a "FileName", which is the filename with the timestamp stripped out. DownloadFile uses System.IO.FileStream
to present the document.
Nowhere do I see a "translation" from one timestamp to another ... but it boggles me how it works if I can see the name + (version?) + timestamp for a newly created file in the db is not the same as the physical file I see on the server. How does it find
Feb 21, 2006 03:28 PM|mikeh36|LINK