Copied to clipboard

Flag this post as spam?

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


  • Vincent DeCapite 64 posts 83 karma points
    Oct 28, 2010 @ 13:49
    Vincent DeCapite
    0

    Courier Not Transferring Custom Datatype Files

    Hi All,

    I am using umbraco with a custom data type to attach files to a PDF. When I go and try to transfer the information with courier this does not get treansferred. I have tried to add an XPath and a regular expression to the courier.config but with no luck. Also tried umbraco support and they seemed to be stumpt by this as well.. Any help would be greatly appreciated. Here is what I have tried so far with the code:

    ProductDocuments.ascx

    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="ProductDocuments.ascx.vb" Inherits="usercontrols_datatype_ProductDocuments" %>
    <asp:ListBox ID="ListBox1" runat="server" Width="300" Height="200"></asp:ListBox>
    <asp:Button ID="btnDelete" runat="server" Text="Remove Item" />

    <br />
    <table>
        <tr>
            <td>Document:</td>
            <td><asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList></td>
        </tr>
        <tr>
            <td>File:</td>
            <td><asp:DropDownList ID="DropDownList2" runat="server"></asp:DropDownList></td>
        </tr>
        <tr>
            <td></td>
            <td><asp:Button ID="btnAdd" runat="server" Text="Add" /></td>
        </tr>
    </table>
     
    <br />
    <asp:HiddenField ID="hdnValue" runat="server" />
    <br />

    ProductDocuments.ascx.vb

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Imports

     

     

    System.Xml

    Imports

     

     

    umbraco.cms.businesslogic.media

    Partial

     

     

    Class

    usercontrols_datatype_ProductDocuments

     

    Inherits

    System.Web.UI.UserControl

     

    Implements

    umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor

     

    Private doc As New

    XmlDocument()

     

    Public Property value() As Object Implements

    umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor.value

     

    Get

     

    'Return DropDownList1.SelectedValue

     

    'Return HiddenField1.Value

     

    'Return String.Empty

     

    'Return hdnValue.Value

     

    Return

    doc.InnerXml()

     

    End

    Get

     

    Set(ByVal value As Object

    )

     

    If Not IsDBNull(value) AndAlso Not String.IsNullOrEmpty(value)

    Then

     

    Try

    doc.LoadXml(value)

    LoadData()

     

    'hdnValue.Value = doc.OuterXml().ToString()

     

    Catch

    doc.LoadXml(

     

    "<documents />"

    )

     

    End

    Try

     

    End

    If

     

    End

    Set

     

    End

    Property

     

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me

    .Init

    doc.LoadXml(

     

    "<documents />"

    )

     

    End

    Sub

     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me

    .Load

     

    If Not Page.IsPostBack

    Then

     

    'doc.LoadXml("<specs />")

    hdnValue.Value = doc.OuterXml.ToString()

     

    Dim xds As New

    XmlDataSource()

    xds.DataFile =

     

    "/inc/product_documents.xml"

    xds.XPath =

     

    "//option"

    DropDownList1.DataSource = xds

    DropDownList1.DataTextField =

     

    "name"

    DropDownList1.DataValueField =

     

    "name"

    DropDownList1.DataBind()

    DropDownList1.Items.Insert(0,

     

    New ListItem("Please Choose...", String

    .Empty))

     

    Dim m As New

    Media(2398)

     

    For Each f As Media In

    m.Children

    DropDownList2.Items.Add(

     

    New ListItem(f.Text, String.Format("{0}||{1}"

    , f.Id, f.Text)))

     

    Next

    DropDownList2.Items.Insert(0,

     

    New ListItem("Please Choose...", String

    .Empty))

     

    Else

    doc.LoadXml(hdnValue.Value)

     

    End

    If

     

    End

    Sub

     

     

    Sub

    LoadData()

    ListBox1.Items.Clear()

     

    Dim index As Integer

    = 1

     

    For Each n As XmlNode In doc.SelectNodes("//document"

    )

    ListBox1.Items.Add(

     

    New ListItem(n.Attributes("name").Value & ": " & n.Attributes("file"

    ).Value, index))

    index += 1

     

    Next

    hdnValue.Value = doc.OuterXml.ToString()

     

    End

    Sub

     

     

    Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles

    btnAdd.Click

     

    'Response.Write("[[" & hdnValue.Value & "---" & doc.OuterXml.ToString() & "]]")

     

    Dim name As String

    = DropDownList1.SelectedValue

     

    If Not String.IsNullOrEmpty(name) AndAlso Not String.IsNullOrEmpty(DropDownList2.SelectedValue)

    Then

     

    Dim value As String() = Split(DropDownList2.SelectedValue, "||"

    )

     

    Dim node As XmlNode = doc.CreateElement("document"

    )

     

    Dim at As

    XmlAttribute

    at = doc.CreateAttribute(

     

    "name"

    )

    at.Value = name

    node.Attributes.Append(at)

    at = doc.CreateAttribute(

     

    "file"

    )

    at.Value = value(1)

    node.Attributes.Append(at)

    at = doc.CreateAttribute(

     

    "id"

    )

    at.Value = value(0)

    node.Attributes.Append(at)

    doc.DocumentElement.AppendChild(node)

    LoadData()

     

    End

    If

    DropDownList2.SelectedValue =

     

    String

    .Empty

    DropDownList1.SelectedValue =

     

    String

    .Empty

     

    End

    Sub

     

     

     

    Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles

    btnDelete.Click

     

    If Not String.IsNullOrEmpty(ListBox1.SelectedValue)

    Then

     

    'Response.Write("[[" & ListBox1.SelectedValue & "]]")

     

    Dim node As XmlNode = doc.SelectSingleNode("//document[" & ListBox1.SelectedValue & "]"

    )

     

    If node IsNot Nothing

    Then

    node.ParentNode.RemoveChild(node)

    LoadData()

     

    End

    If

     

    End

    If

     

    End

    Sub

     

    'Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender

     

    ' Dim debug As New TextBox()

     

    ' debug.Text = doc.OuterXml.ToString()

     

    ' debug.TextMode = TextBoxMode.MultiLine

     

    ' debug.Width = 400

     

    ' debug.Height = 400

     

    ' Me.Controls.Add(debug)

     

    'End Sub

    End

     

     

    Class

     

    Any help would be greatly appreciated with this since we basically can't use courier until this is fixed..

    Thanks

  • Antony Briggs 78 posts 103 karma points
    Oct 29, 2010 @ 10:48
    Antony Briggs
    0

    Hi,

    I'm having problems with Courier too, so maybe we can help each other :)

    Can you clarify your set up? As I understand it, you have a custom datatype that contains a reference to a Media node where the PDF is located? Or does it contain the location of a PDF in the filesystem? I can both of these Scenarios to work fine (link to Media and link to file) - I'm stuck with a link to a content node!

    TTFN

    Ant

  • Maneesh 13 posts 33 karma points
    Jun 01, 2015 @ 06:54
    Maneesh
    0

    Hi All,

    I have the problem with umbraco courier.Whenever i transfer any media file like pdf,doc,xls(except image files .gif,.png,.jpeg) from staging to live(destination environment), it doesnot transferring the media files.That means, the content nodes are getting transferred, but the files like pdf,doc,xls included with in that page is not getting transferred.

    But there is not having an issue with image files as I mentioned above.

    The umbraco version Using is : 4.0.2.1

    The courier vesion using is : 1.3

    Could anyone please suggest an idea about why this is happening?

    Also, please suggest the solution for fixing the same.

Please Sign in or register to post replies

Write your reply to:

Draft