Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

mimeType error with xml csv

default discord avatar
legardus2 years ago
26

Hey little question,


Does the mimeType "text/csv" isnt supported by payload? I try to upload .csv files but i get an mimeType error




Edit: even got the same thing for .xml files ( application/xml)



https://github.com/payloadcms/payload/issues/6473

error screen, got the same thing for "text/csv"



Tried with pdf "application/pdf" it works but not for xml csv

  • default discord avatar
    markatomniux2 years ago

    what version of Payload are you using, and what DB are you using?

  • default discord avatar
    legardus2 years ago

    for instance i used the docs of mdn here



    latest version and postgres

  • default discord avatar
    markatomniux2 years ago

    v3 or v2?

  • default discord avatar
    legardus2 years ago

    v3

  • default discord avatar
    markatomniux2 years ago

    ok, v3 is still in beta so there are still some kinks being worked out

  • default discord avatar
    legardus2 years ago

    ouch

  • default discord avatar
    markatomniux2 years ago

    the most recent version includes a change to the uploads collection type, specifically for image uploads and focal point cropping. Try using beta.34

  • default discord avatar
    legardus2 years ago

    how may i change to test?

  • default discord avatar
    markatomniux2 years ago

    yarn add payloadcms@beta.34



    then also downgrade all other payload plugins and tools that have the "beta" version

  • default discord avatar
    legardus2 years ago

    if node = npm install payloadcms@beta.34, and if i put in beta will there be issues to my existing code? I use no plugins atm

  • default discord avatar
    markatomniux2 years ago

    If you used npm then do

    npm install

    rather than

    yarn add

    . Before you do though, can you try uploading an image? Make sure to change the mimeTypes to allow images



    if the image upload works, I am 99% sure it's caused by the latest commit from

    @967118574445547650
  • default discord avatar
    legardus2 years ago

    already made images with another collections called media and it works



    here is the screen

  • default discord avatar
    markatomniux2 years ago

    ok cool. If you roll back your payload version and it works, then that means the latest update has a breaking change



    We can create an issue to get it fixed 🙂



    https://github.com/payloadcms/payload/issues/new?assignees=&labels=status%3Aneeds-triage%2Cv3&projects=&template=1.bug_report_v3.yml
  • default discord avatar
    legardus2 years ago

    just a question how do i roll back after getting into beta?

  • default discord avatar
    markatomniux2 years ago

    just do

    npm install payload@beta.34

    you are just rolling back minor versions of the v3 beta



    you are currently on beta.35 if you have the latest

  • default discord avatar
    legardus2 years ago

    ahhh ok ok, i'm creating the issue, ty for your help till now



    @191776538205618177

    if i do not use next.js what do i put in the field ?

  • default discord avatar
    markatomniux2 years ago

    if you are using Payload v3, it uses NextJS

  • default discord avatar
    legardus2 years ago
  • default discord avatar
    markatomniux2 years ago

    thanks!!

  • default discord avatar
    legardus2 years ago

    thanks for your help, gonna eat and then try the beta 34 thing

  • discord user avatar
    denolfe
    2 years ago

    If you remove the mime type prop and then upload each of those files. What does the detected mime type say in the data? I'm guessing that the detected mime type may be slightly different than what you're setting in code.

  • default discord avatar
    legardus2 years ago

    With your method it does work, i remove mimetype and i can upload both files, (csv and xml),



    In my case, i wont make the mistake when i upload, but for my client is their no way to limit them only to csv and xml?

  • discord user avatar
    denolfe
    2 years ago
    What does the detected mime type say in the data?

    Check the data for what mime type was detected for those files. API tab.

  • default discord avatar
    legardus2 years ago

    thanks a lot will do!



    application/vnd.ms-excel for CSV


    text/xml for XML




    IS THE ANSWER

  • discord user avatar
    denolfe
    2 years ago

    Just a note, csv files not created in excel might have a slightly different mimetype. You can probably test that and also add it to the array.

  • default discord avatar
    legardus2 years ago

    Noted will do all cases then, thanks a lot for your help and thanks Mark too

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.