Copied to clipboard

Flag this post as spam?

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


  • houdtbaar 15 posts 20 karma points
    Jan 29, 2009 @ 17:00
    houdtbaar
    0

    Handling File uploads from public through a form

    Hi,


    I'm trying to get my file upload extension working fro a project we are doing. I have tried to make an extension in C# to which accepts HttpPostedFile for the uploaded file. But the error message states the following;

    [quote]
    Error parsing XSLT System.Xml.Xsl.XslCompiledTransform
    Extension function parameters or return values which have Clr type 'HttpPostedFile' are not supported.
    at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList1[] args)<br /> at System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in C:\Inetpub\xxxxx\xslt\Werkzoekende.xslt:line 45
    [/quote]

    The end result should be that the uploaded file is attached to an e-mail message and send to an email address. before this is done we need to check the mime type to prevent "not welcome" file types. I'm using Umbraco v4.0RC3.

    Can anybody help me with this?

    Thanks.

    xslt form:
    [quote]
    ]>

    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    xmlns:Mirabeau="urn:Mirabeau"
    exclude-result-prefixes="msxml Mirabeau umbraco.library">



























    [/quote]



  • Tim Geyssens 1060 posts 27 karma points
    Jan 29, 2009 @ 17:05
    Tim Geyssens
    0

    Wouldn't it be easier to do this with a .net usercontrol ?

  • Ismail Mayat 4511 posts 10059 karma points MVP 2x admin c-trib
    Jan 30, 2009 @ 09:57
    Ismail Mayat
    0

    houdtbaar,

    Use doc2form that can handle uploads and sends out emails.

    I have done it in the past where i wanted end users to be able to upload as part of job application a cv/resume. You can get it from codeplex. As a general rule of thumb use xslt for data presentation and .net controls for data capture.

    Regards

    Ismail

  • houdtbaar 15 posts 20 karma points
    Jan 30, 2009 @ 14:43
    houdtbaar
    0

    Thanks, I will try doc2form.

    Regards,
    Erik

  • houdtbaar 15 posts 20 karma points
    Feb 02, 2009 @ 10:36
    houdtbaar
    0

    I have tried doc2form 2 beta 3. Every thing is weel when creating the form, but after submitting the form I get the error listed bellow, any suggestions whan i'm doing wrong?

    I have search the forum, but no sollutions yet.


    [quote]Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
    cln.umb.Doc2Form.btnSubmit_Click(Object sender, EventArgs e) +7459
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


    Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
    [/quote]

  • Finn 86 posts 50 karma points
    Feb 02, 2009 @ 10:59
    Finn
    0

    What about the form wrapping. Did you remember that?

    Try placing the control inside an ASP.Net form (

    ) like described in this post:

    http://forum.umbraco.org/yafpostst7471doc2form-not-working-on-v4.aspx

    Maybe that is the problem?

    /Finn

  • houdtbaar 15 posts 20 karma points
    Feb 02, 2009 @ 11:02
    houdtbaar
    0

    No I did not forget the wrapping, see the code from my template bellow:

    [quote]
    FORM>
    MACRO PublishOnSubmit="0" DocumentType="1250" TabName="formulier" PageTabs="0" HideTabNames="1" ShowDescriptions="0" RequiredText="Dit veld is verplicht" SubmitButtonText="verzenden" PreviousButtonText="" NextButtonText="" TextOnSubmit="Bedankt voor het verzenden" RedirectToNode="" StorePropertiesInCookies="" SendEmailResponse="0" ResponseSubject="" ResponseMessage="" ResponseEmailFieldAlias=", " ResponseCopyTo="" EmailForm="0" FormSubject="Sollicitatie via de website" FormMessage="geen idee
    " FormToEmailAddress="xxxx" FormFromEmailAddress="xxxxx" UseAjax="0" DefaultValueNode="" macroAlias="Doc2FormEmail">
    [/quote]

  • Ismail Mayat 4511 posts 10059 karma points MVP 2x admin c-trib
    Feb 02, 2009 @ 16:23
    Ismail Mayat
    0

    you are using v4 change your form tag to standard .net one ie





    Regards

    Ismail

  • Scott Hugh Alexandar Petersen 349 posts 164 karma points
    Feb 02, 2009 @ 16:45
    Scott Hugh Alexandar Petersen
    0

    If you change your

    tags you have to change your umbraco macro tag as well. I don't think it would compile correctly the way you do it if not changed.

    So to say like this
    [code][/code]

    Regards,

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies