Virtual Happy Hour is canceled this month (March) due to Good Friday.
Virtual Happy Hour is canceled this month (March) due to Good Friday.
Hi Tore
I'm afraid I don't have a good answer for you right now. However, they way I see it you shouldn't be needed to do anything more then what you do to make it work. The file manager should display the reason in a nice way. I've added that as a bug that we hopefully can fix for a future version:
Bug #11287: File Manager doesn't handle cancelling of file upload
One other thing though. Not sure that you are using the correct event. If you cancel in UnifiedFileCheckingIn I think the file will still be uploaded, it will just not be check in. I suspect UnifiedDirectory.OnFileAdding might be better, although I haven't actually tested it out.
You could use a popup with something like:
HttpContext.Current.Response.Write("alert('File type not allowed.');");
Hei Per and Greger.
I will try the HttpContext.Current.Response.Write("alert('File type not allowed.');"); until the bug has been fixed.
The reason why I use UnifiedFileCheckingIn is that the extesion of the file when using OnFileAdding is .TMP. Is there a way to get the right extension of the file using OnFileAdding?
If not, I will have to use the UnifiedFileCheckingIn or the UnifiedFileCheckedIn event to check the extesion, and then delete the file if the extension is not allowed?! Do you have a better sugestion?
BR,
Tore
Hi.
I can use the OnFileAdding. I tried with an .GIF file, and this extension is .TMP when the file is uploaded. Is there a reason for that? Is there any other files that have .TMP on the upload event?
BR,
Tore
Hi Greger.
For some reason, a GIF file had an .TMP extesion. But now every file type works fine and I am using the UnifiedDirectory.OnFileAdding event.
Thanks for your help!
BR,
Tore
I am trying to limt the allowed filetypes in the upload dir in EPiServer CMS 5. This can be done with the FileEvents. But is there a nice way to display an errormessage back to the user? Now I set the e.Cancel to true and set the e.reason to an errortext in my languagefile. But this only returns an exception message. Is there another way to display a friendly errormessage to the user?
BR,
Tore