checking filename of attachment - InfoPath Dev
in

InfoPath Dev

checking filename of attachment

Last post 05-22-2007 06:43 AM by nukkumatti. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-18-2007 09:07 AM

    • dreadz
    • Not Ranked
    • Joined on 05-18-2007
    • Posts 4

    checking filename of attachment

    I need to extract the filename from an .xls attachment in a form and check it to see if it is valid for sharepoint. Is it possible to do this in JavaScript in the Script editor? Could anyone offer me any pointers please cos I havent got a clue how to do either part! thanks
  • 05-21-2007 08:51 AM In reply to

    Re: checking filename of attachment

    This could be done a couple different ways.

    I think the easiest would be to do the check in the form itself when it is being attached.  I would have rules that check the attachment field and then notify the user via an alert box or whatever you need.

    On the backend you could parse the xml file itself and find the attachment field and check the filename but this would require a seperate process and would not give the user and usable feedback.

    Hope this helps.

  • 05-22-2007 01:55 AM In reply to

    • dreadz
    • Not Ranked
    • Joined on 05-18-2007
    • Posts 4

    Re: checking filename of attachment

    Clay Fox:

    I think the easiest would be to do the check in the form itself when it is being attached.  I would have rules that check the attachment field and then notify the user via an alert box or whatever you need.

     

     Well sure, thats exactly what I'd like to do. I don't think its possible to do that though is it? Querying the attachment field in InfoPath querys the actual attachment, not the name of the attachment. Hence needing somehow to extract the filename from the Base64 encoded attachment header (which would be almost impossible for me as I dont know any JavaScript). I am completely new to InfoPath btw, so maybe I am missing something? Any advice appreciated, thank you.

  • 05-22-2007 06:43 AM In reply to

    Re: checking filename of attachment

    To jump in here with an additional question. I tested this, so i created a really simple form with just an attachment field, a textbox and a button. First i attached a file, then after i pressed the button the attachment control value was written into the textbox. this gave me like expected not the name of the attachment but the base64 encoded text.

    additionally i saved the form to my drive opened it with notepad and copied the complete base64 text out of the xml. funny thing, when i parsed the text back it obviously showed me the complete content of the file i attached (was a xml file) but the name of the attachment is nowhere mentioned. so i believe once the file is attached you cannot get the name back, or a least i don't see a way jet.

    Only possible thing, if it is possible like clay mentioned to capture the name when attaching it then you could store this name in an additional textbox control from where you later could receive the it back easily. question now --- how to capture the name

    Listen to Motörhead cos they play Rock'n Roll :)
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.