Copied to clipboard

Flag this post as spam?

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


  • Vincent Baaij 95 posts 344 karma points c-trib
    Apr 18, 2014 @ 21:58
    Vincent Baaij
    0

    Please share the code for transfering images

    Hi,

    In the uHangout episode you showed a way to transfer media items from an 'old' site to a 'new' site. If I understood correctly, it is done with a webapi. I could really use this for a site I'm working on.

    Thanks.

  • Antoine 176 posts 1494 karma points
    Apr 21, 2014 @ 21:47
    Antoine
    0

    You are right Vincent, we are using a webapi to do that, but you can also do the same thing through base.

    In your "old" instance, create a webapi with this method:

    [RestExtension("Helper")]
    public class Helper
    {
        [RestExtensionMethod(returnXml=false)]
        public static string MediaPathById(string id) {
            return new Media(int.Parse(id)).getProperty("umbracoFile").Value.ToString();
        } 
    }
    

    In the "New" Instance, in your proxy method, replace each media fields in the legacy umbraco.config by the path to the file "c:/../../yourfile" (depend on your structure, you will have to download it first). Take an account that uMirror when the property is an mediaPicker expect a path to a file.

    Let me know If you have any other question

Please Sign in or register to post replies

Write your reply to:

Draft