Attachments and FileUpload.ashx

Jul 30, 2013 at 10:14 PM
Edited Jul 30, 2013 at 10:16 PM

I am running AF 5.0.2 on DNN 6.2.6. I am trying to understand how the attachments work. I see that the code in af_attach.ascx is trying to post to sf.getServiceRoot('ActiveForums') + 'FileUpload.ashx/UploadFile' . From firebug I see that it is posting to http://localhost/DesktopModules/ActiveForums/API/FileUpload.ashx/UploadFile , but I don't find API folder in the ActiveForums directory. But still, the post succeeds and I can upload the files fine. I am just trying to understand where this handler is and how is that it is working. Any help is greatly appreciated.

Thank you,
Jul 30, 2013 at 10:16 PM
Jul 30, 2013 at 11:46 PM
Edited Jul 31, 2013 at 12:25 AM
Thanks Chris for quick reply!! Ok, I just started understanding how the service framework works. I understand that IMapRoute.MapRoute is the key, but I don't find FileUploadController.cs file in the ActiveForums module. I found one in Journal module and route registered as

mapRouteManager.MapRoute("Journal", "{controller}.ashx/{action}", new { Controller = "Services", Action = "Index" }, new[] { "DotNetNuke.Modules.Journal" });

Is this the one used by ActiveForums? If so, how is this called from ActiveForums since moduleFolderNames are different. I don't know much about service framework, I just started to learn it, any information is much appreciated.

Jul 31, 2013 at 8:46 PM
Can some one please help!! The issue is, we have a separate location where we save user uploaded files, and by default the attachments from forums are saved at DotNetNuke\Portals_default\Users folder. I want to change the default location to the user uploaded files location. Also, this becomes important as we are planning to move to clustering environment. Is there a way the attachment upload location can be configured? Any help is greatly appreciated.

Jul 31, 2013 at 8:51 PM
It does appear that AF uses the Journal's upload service

addImageServiceUrl: sf.getServiceRoot('Journal') + 'FileUpload/UploadFile',

that is from af_attach.ascx
Jul 31, 2013 at 9:46 PM
Thanks Chris for replying!! On AF 5.0.2, I see following

addImageServiceUrl: sf.getServiceRoot('ActiveForums') + 'FileUpload.ashx/UploadFile'

It is getting the path from ActiveForums not Journal, but still somehow it works. So, it looks like it ignores module path and matches by controller and action. Is this correct??

Also, could you please help on my second question, is there a way the attachment upload location can be configured? I want to use different location than the default which is DotNetNuke\Portals_default\Users.

Jul 31, 2013 at 9:48 PM
Sorry I forgot you were on the old code, I was looking at the 5.0.4 DNN7 code.

As for changing the location, I really don't know, I don't have the old code available to play around with, so I am not sure what the options are.
Aug 1, 2013 at 5:02 PM
Thank you Chris for the response! I understand that you don't have the old code but can you suggest how I could change the location for FileUpload from Journal module? Looks like AF 5.0.2 somehow is using FileUploadController form Journal anyway, this might help me figuring out what I need to do.

Thank you,
Aug 1, 2013 at 5:03 PM
Ana, I really don't know where to being with the Journal code. You would have to open the Source for DNN and start looking in there