Problem uploading profile picture directly to Xano (followed docs but get error)

Hi! I am trying to upload an image file directly to my Xano database (bypass Weweb CDN) following this tutorial with the custom JS - File Upload | Weweb documentation

However, I keep getting this error:
image

The error I get is “cannot read properties of null: (reading files)”

I am wanting to add the image to my sign up end point but I created a new end point just to isolate the problem, and I still can’t get that action to work.

Actually there are multiple posts in this community with this exact issue but nobody seems to have a solution…

This is the POST end point I am using in Xano:

Is there a video tutorial or something that shows how we can allow users to upload a profile picture directly to Xano upon signing up, that would be great… the current one in the docs is too confusing and does not work (the error above) and is missing critical info about what to do in Xano

replace document with wwLib.getFrontDocument()

Hi! I tried that and am still getting this error: “Cannot read properties of undefined (reading ‘0’)”
image

This is the code:

In case you need it, this is the file upload element’s settings:

means that document.querySelector('selector') becomes wwLib.getFrontDocument().querySelector('selector')

wwLib.getFrontDocument() returns just the right document to work with in the editor and in the published app.

I did that but still getting an error, any idea why?

The JS code:

The error:

double check your url

Just double checked! But getting a 400 error: “{“code”:“ERROR_CODE_INPUT_ERROR”,“message”:“Value is not properly formed.”,“payload”:{“param”:“content”}}”

The code is the same as above but with the correct end point url.

The end point itself (there’s other stuff I want to add but I deleted it to isolate the problem):

it may be a mismatch in the naming. try renaming the file resource in xano to something elese and then again tocontent

Oh! I fixed it. I didn’t upload any image that’s why. Thank you :slight_smile:

2 Likes