PodioImporter::process_app for xlsx files

Answered

Comments

8 comments

  • James Trusler

    Oh the value of the column I have put as the id in excel... I assume that's right?

    0
    Comment actions Permalink
  • James Trusler

    It's a money value in excel and money field in Podio

    0
    Comment actions Permalink
  • James Trusler

    Oh yeah, the uploaded file id comes from code called previously before:

    $uploadResult = PodioFile::upload( $filePath . $fileNameWithExt, $fileName );

    0
    Comment actions Permalink
  • Christian Holm

    The problem is that we do not know what type of file it is. You should supply the content-type when you upload the file.

     

    0
    Comment actions Permalink
  • James Trusler

    Cheers Christian...

    Is there another parameter to the $args I should add...? Is there an example bit of code I can use? I have tried:

    "content_type" => "application/openxmlformats-officedocument.spreadsheetml.sheet",

     

    I assume I should be embarrassed at my feeble attempt but i'm confused. I do not directly have access to the curl content headers from the Podio API... or..dooo iii?

    0
    Comment actions Permalink
  • Andreas Haugstrup Pedersen

    It could be a good exercise for you to make the needed changes in podio-php to facilitate passing a content-type as an option to PodioFile::upload() that would be passed onto curl. I would be happy to review any pull requests on github :)

    /Andreas

    0
    Comment actions Permalink
  • James Trusler

    I've made a start...

    Haven't really looked into your code before, so may take me a while (customer will have to wait on this one :( ). Just a few questions to make sure i'm doing what is expected:

    The curl request that the PodioFile::upload uses is the one I need to set the custom header for... from this, you guys assign the file type to the request and return the file id with that info stored behind it.

    When using PodioImporter::process_app, you get the information from the file id and realise you do not know what file type it is and thus throw an error? 

    Does this sound right?

    0
    Comment actions Permalink
  • James Trusler

    I've added a new section in my own code that adds content-type header to the upload request... I now get this error:

    Fatal error: Uncaught PodioBadRequestError: "'utf8' codec can't decode byte 0xfa in position 202: invalid start byte"

    I'm not really sure what to do to make this import function work. I think i'll abandon this for now, I've unfortunately got a bit of a tight deadline :)

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk