Copied to clipboard

Flag this post as spam?

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


  • Harm-Jan Abbing 62 posts 102 karma points
    Mar 23, 2012 @ 10:24
    Harm-Jan Abbing
    0

    Saving media from url instead of FileUpload

    Hi guys,

    With custom .net forms i normally create media by use of upload fields and Media.MakeNew. This time i'm trying to save an image with a set url like "http://www.domain.com/sample.gif". Hoe can i best go about doing this?

    Kind regards,
    Harm-Jan

  • Harm-Jan Abbing 62 posts 102 karma points
    Mar 23, 2012 @ 11:41
    Harm-Jan Abbing
    0

    Succeeded in doing this by using following code (System.Web.Helpers namespace required):

    var request = (HttpWebRequest)WebRequest.Create(imageUrl);
    var response = (HttpWebResponse)request.GetResponse();
    WebImage image = new WebImage(response.GetResponseStream());
    image.Save(fullFilePath, extension);
Please Sign in or register to post replies

Write your reply to:

Draft