ASPX templates
Version 4.x > ASPX templates > Please explain redirect files to disk setting View modes: 
User avatar
Member
Member
random0xff - 5/31/2009 2:40:15 PM
   
Please explain redirect files to disk setting
I don't really understand the file settings, especially redirect to disk.

For example, I have a file uploaded to the content tree, it's original name was "test.png" and the document name become "test" after adding/uploading. I have "store files in database" on, "store files in filesystem" on. It is stored as binary in the CMS_Attachment table AND on disk with a guid as file name.

My first question: why this name? It would be better to replicate the tree structure on disk and give the files their original name.

Now I insert the file in the rich text editor on some page with a cms:CMSEditableRegion control on it. The value of the src attribute of the img tag is /page/test.aspx. (Using Firefox) If I right click and choose "Save Image As..." the name is "test.png" (original name). I can also right click and choose "View Image" and it will open /page/test.aspx and I can again right click and choose "Save Image As..." and the name will be "test.png"

Now I turn on the option "redirect files to disk" and refresh the page. The path to the image is the same. But, when I right click and choose "Save Image As..." I get a file name of "test.aspx" which is not good.

My second question: why not test.png because if users save this file on their computer it will not be associated with any file type.

I can also right click and choose "View Image" to go directly to the /page/test.aspx URL, but then the content-disposition it set to attachment, so I get a prompt to save the file (from Firefox). The image name is now {guid}.png

My third question: why does the setting "Redirect files to disk" change the content-disposition when directly viewing the file in the browser?

My last question: why is the file name different if the "Redirect to disk" setting is on? Surely in ASP.NET you can just give the original file name before as part of the response to the browser?

My conclusion based on this experiment: the "Redirect files to disk" setting is nice for performance reasons, but the resulting file names and the content-disposition change make it unsuitable for me (and maybe others). Please consider changing the behavior or allowing this bahavior to be modified in the settings.

Looking forward to your reaction.

User avatar
Member
Member
random0xff - 5/31/2009 2:51:00 PM
   
RE:Please explain redirect files to disk setting
Also, this is just for me to get a better understanding. If "Store files in database" is off, and "Redirect files to disk" is also off, what happens?

Doesn't Kentico _always_ have to redirect to disk if the files are not stored in the database? So then the redirect setting is strange in that case, right?

In that case, do I have the performance benefit? I think the answer must be yes, because no file is in the database, so no queries for binary information. But as long as I keep "Redirect files to disk" off, I don't have the strange behavior described above, with the content-disposition and guid file name.

So, I conclude that this is the best way to go? In that case, the complete "Redirect files to disk" setting in not needed?

Please explain, because I am more confused after testing than I was before. Also, as usual the documentation is not clear about these things. It is just more of the default documentation that only repeats what is already said in the GUI :-(

User avatar
Kentico Developer
Kentico Developer
kentico_zbysekn - 6/11/2009 6:41:50 AM
   
RE:Please explain redirect files to disk setting
Hi,
Well this is by design solution, but I have added requirement for better name handling to our developers. First of all, files are stored to file system with guid because it's unique identificator, so no other queries are necessary to identificate file and that's one of the purposes of storing files on filesystem, no queries to database. Redirect files to disk determine that if file could be obtained from file system it will be accessed there instead of copy in database. If you have checked only Store files in file system without checking Redirect files to disk, then obtained files are managed by our GetFile script, but if you check it they will be accessed directly, which add significant performance.
Best Regards,
Zbysek Nemec.



User avatar
Member
Member
random0xff - 6/11/2009 4:17:26 PM
   
RE:Please explain redirect files to disk setting
Ok, I thought redirect files means to go _really_ directly to the file:

<img src="/site/files/abcd.png"/>

But there is still the getfile in between. Maybe an option to go _really_ to the file would be nice as well. It's too bad about the guid. In general file handling in Kentico is difficult (except when you use the GetImage() method in transformations, but there is no easy GetImage() outside of transformations). I want to always make sure that a user can save an image in the original name.

User avatar
Kentico Developer
Kentico Developer
kentico_zbysekn - 6/16/2009 9:47:35 AM
   
RE:Please explain redirect files to disk setting
Hi,
yes redirect files to disk means that you get file directly from file system, unfortunately as I mentioned the file name handling is by design and can't be changed now.
Best Regards,
Zbysek Nemec.