"sniffing" file header code of picture attachment - InfoPath Dev
in

InfoPath Dev

"sniffing" file header code of picture attachment

Last post 11-27-2006 08:24 AM by dgibson5531. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-21-2006 07:59 AM

    "sniffing" file header code of picture attachment

    I need to pull a file attachment from an InfoPath form, specifically a picture. I have some sample code to convert the picture from base64 to binary but you need to determine the type of file coming in (jpeg, bitmap, etc). Not sure how to code that. Can someone help me with an example of checking the header to determine file type ?
  • 11-21-2006 09:34 AM In reply to

    Re: "sniffing" file header code of picture attachment

    Assuming that you have the byte array of the actual file as stored on disk (without the extra header information that InfoPath tacks on when it is stored in the form as Base64), then you should be able to determine the filetype from the first 10 bytes. I found the following site that has some sample code that does this, but you should be able to find the specification documents somewhere on the Internet that will tell you a little more. The sample program only does a few filetypes, and if you need more than you'll have to look at the specs.

    http://www.codeproject.com/file/ImageClassifier.asp

    Good luck and let us know what you come up with!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 11-27-2006 08:24 AM In reply to

    Re: "sniffing" file header code of picture attachment

    Matt,
    Thank you for your help.

    I have another question reguarding a "How to" article you wrote to update a Sharepoint list from an InfoPath form. I have followed your directions to create a form to update a custom list. The refesh does pull back the list but the submit button to update the list kicks an error message :

    The SOAP response indicates that an error occurred on the server:

    Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.
    <detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    List does not exist.

    The page you selected contains a list that does not exist. It may have been deleted by another user.
    </errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode></detail>

    I have tried changing the GUID to include the brackets, not include the brackets, include the dashed, not include the dashes, everyway I can think of to no avail. One final note on this, this is Sharepoint V3. Can you help me ?
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.