Ability to link directly to files in shared file module

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
1/26/2007 7:33:06 PM
Gravatar
Total Posts 80

Ability to link directly to files in shared file module

Joe,

What do you think about linking directly to files in the shared file module from places outside of the module? The only use case I have for this feature is to send notification emails with a link to download the file that has just been uploaded to a shared file module. I already have the notification emails set up I just need a url to the uploaded file. Thoughts on how to do this?

-Jesse
1/27/2007 10:22:04 AM
Gravatar
Total Posts 18439

Re: Ability to link directly to files in shared file module

Hi Jesse,

The challenge is in securing access to the files so that only users with permission can download it. If the files were stored on disk using their original extensions like .doc or whatever, they could be requested directly by url, but since requests for .doc would be handled directly by IIS and bypass .NET (unless you do some major configuration changes on the server) there is no way for .NET code to intercept requests for .doc files and apply permission checks. Anyone who knows the url can download the file. The shared files module handles this by storing files on disk with a .config extension which is protected by default in ASP.NET, and the original file names are stored in the db. An url request to an .config file will not be able to retrieve the file.

The easiest way I can think of to implement a solution that allows emailing a link to a file while still keeping it secure would involve making a special page like ~/SharedFileDownload.aspx?pageid=x&mid=y&fileid=z

I could add a column for Download Link in the grid with a preconfigured link for each file, then you could right click the link and choose copy link location and then paste that into an email that you send. The SharedFileDownload.aspx page would verify the user has permission and if so return the file.

Would a solution like that be sufficient for your needs?

Joe
1/28/2007 1:04:34 AM
Gravatar
Total Posts 80

Re: Ability to link directly to files in shared file module

Yes this would be sufficient. Having the URL easily available in the code will be helpful so I can programmatically insert it into the message of a notification email.

On another note I will be sending you code for a transaction module and role based contact form module in the next week or so. Once I finish refactoring and testing of course :-)

-Jesse
1/28/2007 9:43:05 AM
Gravatar
Total Posts 18439

Re: Ability to link directly to files in shared file module

This is implemented in svn. You can right click the download link and copy link location for email purposes.

In code you can build an url to the file in this format:
~/SharedFileDownload.aspx?pageid=x&mid=y&fileid=z

It must have the correct pageid, moduleid (mid), and fileid to work. Permission to download the file is equivalent to permission to view the page that the module is on. If the user is not authenticated it will redirect to the login page then after login proceed to the file download.

Joe
9/8/2011 10:14:04 AM
Gravatar
Total Posts 133
J

Re: Ability to link directly to files in shared file module

In case anyone else is looking for this this is now changed from

In code you can build an url to the file in this format:
~/SharedFileDownload.aspx?pageid=x&mid=y&fileid=z

to

~/sharedfiles/download.aspx?pageid=x&mid=y&fileid=z

Oh and fileid = itemid from mp_sharedfiles

Version 2.3.6.7

J

You must sign in to post in the forums. This thread is closed to new posts.