I should specify this element?

Hello, this is breaking my head. I have two uploader elements. For some reason, the uploader when uploads something it returns the value like was uploaded by the other one.

Example:
Uploader A
Uploader B

If I upload something to uploader A, gets published by the uploader B or sometimes and sometimes B uploads to A (if you refresh the page it’s random).

Code:

	const inputElement = document.getElementById(''+uniqueid+'');
	const pond = FilePond.create( inputElement, fileOPs);
	FilePond.setOptions({
    	server: {
          	revert: null,
        	process: (fieldName, file, metadata, load, error, progress, abort) => {
		if (server == "AWS") {
          	   function uploadCback(err, url) {
		    	if (url) {
		      		load(url);
                                publishState("filename", file.name);
                                publishState("fileurl", url);
                                publishState("base64", metadata.base64);
          		        triggerEvent("file_is_uploaded");
                        }
              	else {
	     			console.error(err.toString());
      				error(err.toString());
    			}
         	  };
    		                uploadContent(file.name, metadata.base64, uploadCback);
               }
                        ................................. 

Do you guys see something wrong there?
The only thing I changed recently was the way was selecting the element.
I changed:

const inputElement = document.querySelector('input[type="file"]');

to

const inputElement = document.getElementById(''+uniqueid+'');

Hi @Raiikou, I don’t see anything inherently wrong there… but then again there’s only one input element in your code, so it’s impossible to tell what’s going on with the other one.

if (server == "AWS") {

I have no idea where this variable is coming from.

It also shares the name of the property of the object you’re passing in to setOptions.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.