Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rene 2 posts 22 karma points
    Apr 07, 2014 @ 18:09
    Rene
    0

    Removing HttpPostedFileBase dependency

    Hi, firstly sorry if this is the wrong place to post this question. I was going to put it in issues.umbraco as feature request but wasn't sure if it was the correct place.

    I'm using Umbraco 7.1.0. I want to be able to create Media from my business logic layer. I've added a reference to Umbraco.Core that gives me access to IMediaService what is then passed in from the web project. Using this interface I can now create Media. Problem comes when I try to set the "umbracoFile" property since it requires a "HttpPostedFileBase" to do all the helpful things like creating a file for me. This is a problem for me since "ideally" I do not want to add a reference to System.Web within my logic layer.

    Currently to work around this I've inherited HttpPostedFileBase and just setting the properties from the constructor and passing a FileStream directly into the class.

    Having scanned though your source code it looks like it shouldn't be to hard to add another overload in "ContentBase.SetPropertyValue" for some kind of media model that would include the Stream and file name ect (basically the same as the HttpPostedFileBase class).

    Would this be useful to anyone else? I would be happy to implement the feature but wanted your input before making any actual changes.

Please Sign in or register to post replies

Write your reply to:

Draft