Uploading files from frontend

Hi everyone !

I’m making a product configurator and I would like the users to be able to use and show their own images on the 3D model.

I didn’t host the playcanvas part on my server because I like how the publish/builds manager works, and all the interactions with the iframe on the frontend works great. (I’m using the onMessage event for that).

I already have a set of textures in the editor (they are alpha diffuse maps, on UV1) and can select them from the frontend.

Is it possible to use client side files without hosting playcanvas on my own server?
I’m not sure if my question is clear :smiley:

image

Thanks in advance for the help!
Anthony

ps: Oh, also I have an organisation plan now, yay! :slight_smile:

Hi @TonyLGC ,

It’s not possible to have users upload assets to your PlayCanvas project, similar to what you do when using the PlayCanvas editor.

But what you can do is have users upload models (e.g. GLB files) to your server using a regular HTML upload button and then load those models in a PlayCanvas script of yours.

Check this example on how that works: Loading glTF GLBs | Learn PlayCanvas

2 Likes

Hi @Leonidas , thanks for the help!

I tried to apply what is done in the example, created a new asset and added it to the application assets.
But then when I use app.assets.load, I get a cross-domain error as my texture is stored on the front side.
So now I tried an in-application button and now I can get the user’s file data.
I managed to update the diffuseMap with this :smiley:

Now I have to figure out how to make this userfriendly !

Thanks again :wink: