Custom File Upload Functionality

I am trying to create a form, wherein the users should be able to upload CAD related files (.drw or .asm). But the database collection allows only images and documents.

I have tried writing a backend code to connect to a third party service. And I am trying to use a XMLHttpRequest object to connect to this service. But I believe that Wix does not support XMLHttpRequest object as of now.

I also know that there are apps like Dropbox upload and anyfile upload which could support custom File uploads. But those apps just won’t fit my requirement. This makes my options from limited to none.

So any pointers in building/fixing this upload issue?

Hi Abi!
Wix upload currently supports media and a set of documents only, you could use third party file upload services as you mentioned.
The difference between XML and JSON are in the syntax of the object, you can check this example:
JavaScript Tutorial / js_json_xml.asp

Today most APIs support JSON as it is JS native objects and are shorter and quicker. however, since you can use wix-fetch to edit your request any way you see fit, you can send your request manually (headers and body) as an XML:

If the response you receive is also in an XML format you would need to parse the response yourself.

Hope this helps.

Thank you so much for your reply Omar!!!

I will try using JSON instead, in my code. Also, do you think I can send files over to third-party storage service (For ex…,Dropbox ) using ‘Wix-Fetch’? Cause that would reduce my work by a huge amount.

Thanks in advance.

You could do that. If you wish to use http calls to dropbox api you should follow their api documentation:

Do note a few things, first note that this integration will require code development on your site, with this in mind make sure you search for the best service that suits your needs. The dropbox service might not fit best for this, as it might be too complex and will require more development then other services.
Also, make sure if you are using other APIs this usually requires you to identify using a secret key. You should make sure to write any code that explocitly uses these keys on your backend code, so the keys will not be exposed to your clients.

Good luck!

I’m too here. Is there any manual for this case? It’s difficult to call Dropbox api into Wix, i’m confusing.