File Attachment Control Does Not Display File - InfoPath Dev
in

InfoPath Dev

File Attachment Control Does Not Display File

Last post 08-30-2006 07:47 AM by danielNAthens. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-23-2006 01:03 PM

    File Attachment Control Does Not Display File

    I have an infopath form that has it's data stored in a database (the xml dom), stored in a database. I can retrieve the xml from the database and pop it into my template's DOM and all the data comes back correctly. However, the file attachment is not behaving as it should.

    Even though I have pulled the xml and verified that the attachment is indeed present (it's a base64 encoded string), the file control on the form shows up as empty. Furthermore, when I click the file attachment control, the file open dialog does not appear. This also happens when I try to open a form that has no file attached. The file attachment does work when I open a blank form.

    Any thoughts or ideas about this?

    Thanks.
  • 08-29-2006 06:22 PM In reply to

    Re: File Attachment Control Does Not Display File

    Hi Ben,

    This seems like a weird bug. Are you 100% sure that the DB does nothing to alter the XML at all? What is the data type of the column that you are storing it in? For InfoPath to display the file in the file attachment control it has to have a specific header with some special information in it and if this stuff gets mangled in any way it won't display even if the base64 string is there.

    If possible, could you paste the base64 string that is giving you trouble so we could try it out?
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 08-30-2006 07:47 AM In reply to

    Re: File Attachment Control Does Not Display File

    Matt,
    Thanks for the reply. Unfortunately, this is a known bug with Infopath. File attachments were not orginally part of Infopath; they came with SP1. There is a special processing instruction needed at the top of the infopath xml to activate file attachments. I believe it is something like
    <?mso-infopath-file-attachments-present?>
    . When I open my infopath form for editing, I call the method NewSolutionWithData. This method strips out the processing instruction for file attachments. The data is still there, but the user cannot interact with it. See the following document on the MSDN:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ip2003_ta/html/odc_InfoPath_attaching_files.asp

    quote:
    When the NewFromSolutionWithData method is used to create a new form based on a form template, file attachment controls in the form will be disabled until the form is saved and reopened.



    I think they will resolve the bug in Office 2007.

    Thanks,

    Ben Daniel

    quote:
    Originally posted by Matt Faus

    Hi Ben,

    This seems like a weird bug. Are you 100% sure that the DB does nothing to alter the XML at all? What is the data type of the column that you are storing it in? For InfoPath to display the file in the file attachment control it has to have a specific header with some special information in it and if this stuff gets mangled in any way it won't display even if the base64 string is there.

    If possible, could you paste the base64 string that is giving you trouble so we could try it out?

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.