documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Upload plugin examples not clear, should have better non react examples

Open jagyandeep opened this issue 4 years ago • 3 comments

edit by @derrickmehaffy Transfer to docs team to improve the upload plugin examples (I might be able to submit a PR myself sometime soon)


Bug report

Required System information

  • Node.js version: v14.15.3
  • NPM version: 6.14.9
  • Strapi version: 4.5.1
  • Database: Postgres
  • Operating system: Windows 10

Describe the bug

unable to uploadimage file using upload api with 'field' value.

Steps to reproduce the behavior

  1. Open Postman
  2. Select POST method
  3. Set request body type to form-data
  4. Set required fields (files, refId, ref, field)
  5. Hit send and check console output

Expected behavior

Image should be uploaded and link set to respective content type.

Screenshots

image image

Code snippets

If applicable, add code samples to help explain your problem.

Additional context

If 'field' value is not set in postman, the image is successfully uploaded to media library.

jagyandeep avatar Nov 20 '22 18:11 jagyandeep

I think I see the issue in your request, for your ref you are using a colon where you need a period api::activity:activity instead of api::activity.activity

See my example below:

image

I will however say our docs are not great at laying out exactly what is needed here and how it should be formatted. Just as a tip for you to find the UID you can use the following CLI to get all the UIDs for your content-types: yarn strapi content-types:list or npm run strapi content-types:list

image

derrickmehaffy avatar Dec 28 '22 18:12 derrickmehaffy

I'm going to transfer this issue over to our docs repo so we can work on improving the upload plugin docs to not just include react code examples but actually properly explain all the options and some example values for them in something like postman or thunder client

derrickmehaffy avatar Dec 28 '22 18:12 derrickmehaffy

Hi, Thanks for reporting. I'm closing this issue but it's included in the meta issue for the Upload plugin (https://github.com/strapi/documentation/issues/1948).

pwizla avatar Dec 11 '23 13:12 pwizla