Can't connect upload button to a collection

Hi, I’m having trouble linking my upload button to a collection. I’ve set up my upload button and it is able to upload files to my site. I’ve created the dataset and connected the upload button to a document field. My collection is empty, has three other text fields in addition to the document field and the document field is not the primary field. When I upload a pdf file, it is not added to my collection.

In short, I’ve done everything in the related article in the Wix Help Center (Working with the Connect Upload Button Panel | Help Center | Wix.com) and it’s not working

Hi!

Please share either the code that you where using in your site or a link to your site so one of us, the Wix Code team, can inspect your site and provide you with a solution.

Doron.

The site name is called arctechbending.com under owner account gabriel.chan166@gmail.com. I don’t have a site address yet because the site is not yet published

The uploading process takes place on the Place Order page

Hi again!

You can post the URL of your editor as well (the non-published site).
Only authorized personnel can enter the link and inspect your site.

Doron.

Hello, my apologies for the late response. Here is the URL to the editor https://editor.wix.com/html/editor/web/renderer/edit/9a117191-3aa7-48ea-ac74-dd9a823326b3?metaSiteId=f97b249d-07cb-42c9-a175-76a3e5fd3609&editorSessionId=0dff50c9-a4bc-442d-a943-40129af971be&referralInfo=dashboard

Thanks for the help

Hi Gabriel!

First, it seems like by clicking on #button5 the user is never prompted to choose a file (only by using the upload button).
Then, another problem is that unless the user uses the upload button the whole process is in vain since the upload button is connected via dataset and #button5 is never triggered to save the data.

I think the best way is to get rid of the #button5 and use only the upload button.

Here is an example for a functioning code for an upload button in order to submit images into a gallery.
Make sure to modify the code to your site and make sure to use the correct and relevant field keys, components Id’s and to add the correct event to the upload button:

export function uploadPicture_change(event, $w) {
  if(event.target.value.length > 0){
        console.log('on upload');
        console.log(`Uploading '${$w("#uploadPicture").value[0].name}'`);
        $w("#uploadPicture").startUpload()
          .then( (uploadedFile) => {
            console.log("Upload successful. File is available here:");
            console.log(uploadedFile.url);
  const picObj =  {photos:uploadedFile.url};
            wixData.insert('Gallery', picObj)
            .then((data) => {
                console.log('insert succesful: ' + data);
                $w("#rightGalleryDataset").refresh();
            })
            .catch((err) => console.log('error on insert' + err));
          })
          .catch( (uploadError) => {
            console.log(uploadError);
            console.log(`File upload error: ${uploadError.errorCode}`);
            console.log(uploadError.errorDescription);
          });
    }
}

I hope it works for you!
Please let me know.

Doron.

Hi Doron,

I used your code as an exmaple and while it does upload an image it just creates a new column in the dataset and the field is ‘text’ you can’t then change that field to media gallery. You can change it to image, however if i wanted user upload images into single image collections i can just use the wix upload button! Is it possible to upload these pictures into media galleries? It seems not from the forums