Giter Club home page Giter Club logo

Comments (6)

wellingguzman avatar wellingguzman commented on May 12, 2024

It doesn't support multipart/form-data, (it will ignore the upload data).

from v8-archive.

rijkvanzanten avatar rijkvanzanten commented on May 12, 2024

Question 2:

Why not?

Q 3:

Can the API support multipart/form-data?

from v8-archive.

wellingguzman avatar wellingguzman commented on May 12, 2024

Why not?

No reason at all, we haven't implemented yet.

Can the API support multipart/form-data?

Yes it can support it. Probably the only drawback is that we can't sent user-defined information about this file, such as file title, description.

from v8-archive.

rijkvanzanten avatar rijkvanzanten commented on May 12, 2024

the only drawback is that we can't sent user-defined information about this file, such as file title, description.

If we include fields in the same form with the name matching the database column, it should be doable right?

from v8-archive.

wellingguzman avatar wellingguzman commented on May 12, 2024

The file data uploaded will replace the field containing the user-defined (if any) title, description etc.

Example:

Currently we can do this:

{
  "title": "new article",
  "header_image": {
    "title": "new article header image",
    "description": "a happy team",
    "data": "<base-64-data>"
  }
}

We send user-specific information such as title and description.

On the other hand when we use multipart the data for header_image that field information becomes only the file data: rough example below:

POST /_/items/articles HTTP/1.1
Host: directus-api.local
Content-Type: multipart/form-data; boundary=----Boundary

----Boundary
Content-Disposition: form-data; name="title"

new article
----Boundary
Content-Disposition: form-data; name="header_image"; filename="header_image.jpg"
Content-Type: image/jpeg

<ImageContent>
----Boundary--

The header section has the binary content of the header_image.jpg.

We can research if there's a possible way to send this information through multipart or we can create a workaround.

from v8-archive.

rijkvanzanten avatar rijkvanzanten commented on May 12, 2024

Ahh, yeah we lose the ability to send nested values, that's true. But it would still be useful for asynchronous uploads to /files directly.

Usecase: uploading files to insert into a WYSIWYG editor

from v8-archive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.