Single Image Upload Issue In Xano

Hello Everyone,

I am trying to add an image upload to my Wized Application and I’ve been following this tutorial: https://www.youtube.com/watch?v=_yEuWZHj_64

However, I am only looking for a single image upload

I have attached a screenshot of my function editor for the custom element input however when I submit the form, I am getting 0 files for my main_image_1 (main_image_1: {“0”:{}},)

My main_image_1 is a file resource in Xano and then I am creating image metadata from main_image_1 to add the image into the image field in my table….But 0 is coming through. Do I need the paid plan in Xano for this to work?

Here is a loom further discussing my issue

Hello @lovebrian649

Thank you for your details in explaining the issue.

I’ve had a look at the screenshots and the issue I see is that the main_image_1 is defined under the “Parameters” in the request, this appends to the URL - this is not correct since files can only be sent in the body for xano, I think you can resolve it by moving the key-value pair of main_image_1 from the parameter section to the body section.

Amazing..we’re getting closer. I’m still getting a 500 error Invalid file resource…but moving it to the body section and I now see the file details in Xano

A 500 error implies something went wrong in the server, perhaps there’s a message attached to it?

However, I’ve seen one more thing: the file resource as per the earlier screenshot is called main_image_1 however from this latest screenshot it seems the name given to it is main_adu_img could you reconcile if the names match - both in xano and wized

yeah my fault…forgot to mention that i tried adding a new file resource after watching the youtube video again and called it main_adu_img

everything else is the same except the input name in Xano

Could you share a screenshot of the xano inputs along with the function stack as is now?

Sure thing…thank you for all your help with this…here are the screenshots. The main_image is my image field in the database. I added a screenshot of the table at the end for reference. Those sample images were ones I added directly in Xano

So it looks like its getting my image data on the input…but not able to create the image from this data to add to my image field in the database

I’ve noticed the main_adu_img has a file_resource[] label attached to it - the square braces mean that it is expecting more than one file which I do not think is the case. In xano - you need to edit it the input’s data structure back to the default which is Single try this out and let me know how it goes.

@elvisben You’re amazing… looks like its working now…i see the image in the database

1 Like

Hello,


The correct way to send a file from Wized to xano(or any other REST endpoint) is to use the body section in the Wized request setup - at the moment it is in the parameters section that is why it is not sent as a file.

After moving the file input to the body section ensure that the Key matches the name of the input in xano eg if the key is my_file in Wized the input in xano also needs to be my_file

One more thing to note is the number of files sent. If it is one file ensure that the data structure for the xano input is Single - this is the default. If more than one file the Key value specified in Wized should end with square brackets, using our example above it will be my_file[] also in xano the data structure for the input should be a List