Skip to content
Back

[SOLVED] Image Uploading

  • 0
  • Web
  • Storage
RangerDev
11 Jul, 2023, 19:21

I want to upload images to Appwrite buckets using Editor.JS It is very simple. This is what you have to do:

TypeScript
    image: {
      class: ImageTool,
      config: {
        endpoints: {
          byFile: 'http://localhost:8008/uploadFile', // Your backend file uploader endpoint
          byUrl: 'http://localhost:8008/fetchUrl', // Your endpoint that provides uploading by Url
        }
      }
    }
  }

However, I am not sure what to put in byFile or byUrl. So I did this:

TypeScript
                image: {
                    class: ImageTool,
                    config: {
                        endpoints: {
                        byFile: 'https://cloud.appwrite.io/v1/storage/files?projectId=648bc5020fbda818412e', // Your Appwrite endpoint for uploading files
                        byUrl: 'https://cloud.appwrite.io/v1/storage/files?projectId=648bc5020fbda818412e&url=64ada07bbca91d21cdbc', // Your Appwrite endpoint for fetching files by URL
                        },
                        additionalRequestHeaders: {
                        'X-Appwrite-Project': '648bc5020fbda818412e', // Your Appwrite project ID
                        'X-Appwrite-Key': 'f3532846cc90b31dfa0d46ea92f7c5b56fab919f08e6fca87b4148a0576a5a962c1716a3dba8f140169bbddaad977c533cb58acece1380c4d4ce90eff638a037f667571af4d2f58d28ec6a033d1f8e3cb064a5a7599e6056ef1e75efe4d48e19f206a8ed925b7eca68788722dc5d7f17cc2bb129cb6ef3c73dbae96b0e02e2d3', // Your Appwrite API key
                        },
                    },
                    },

But it gives me this error: { "message": "Param \"fileId\" is not optional.", "code": 400, "type": "general_argument_invalid", "version": "0.10.45" } Please help!

TL;DR
The user wants to upload images to Appwrite buckets using Editor.JS, but is unsure about the endpoints to use. The solution is to use the following endpoints: - `byFile`: 'https://cloud.appwrite.io/v1/storage/files?projectId=648bc5020fbda818412e' for uploading files - `byUrl`: 'https://cloud.appwrite.io/v1/storage/files?projectId=648bc5020fbda818412e&url=64ada07bbca91d21cdbc' for fetching files by URL. The user is getting an error message "Param 'fileId' is
RangerDev
11 Jul, 2023, 19:22

I apologize for the formatting.

RangerDev
11 Jul, 2023, 20:30

I am getting a new error

RangerDev
11 Jul, 2023, 20:30

Access to XMLHttpRequest at 'https://appwrite.io/v1/storage/files' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

RangerDev
11 Jul, 2023, 20:30

@Binyamin or @Steven Your help will be appreciated

Drake
11 Jul, 2023, 20:32

please do not tag people directly as it can be very distruptive. pelase just post and wait for a response

RangerDev
11 Jul, 2023, 20:32

okay

Binyamin
11 Jul, 2023, 20:32

This looks interesting. If you won't find a solution I can look into it later today

RangerDev
11 Jul, 2023, 20:32

I am sorry for pinging you guys

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more