2

I am trying to upload/attach files to a record using the lightning tag 'lightning:fileUpload'.

I have used this tag inside a component and used the component inside an App

It works fine when launching the app via the lightning UI and in communities. But it throws a weird error on salesforce1. The file gets attached to the record but it throws this error

My component is pretty straight forward.

<lightning:fileUpload  name="fileUploader"
                       label= "Demo Upload"
                       multiple="{!v.multiple}"
                       accept="{!v.accept}"
                       disabled="{!v.disabled}"
                       recordId="001g000001y6hAR"
                       onuploadfinished="{! c.handleUploadFinished }"/>

Controller

handleUploadFinished: function (cmp, event) {
    // Get the list of uploaded files
    var uploadedFiles = event.getParam("files");
    alert("Files uploaded : " + uploadedFiles.length);
}

Error screen shot

enter image description here

I did read in the documentation that this tag does not support standalone apps and the component will appear as disabled. But this seems to be working except in Salesforce1.

https://developer.salesforce.com/docs/component-library/bundle/lightning:fileUpload/documentation

4
  • Try putting this component alone in your salesforce 1 - what happens? Feb 13 '19 at 8:06
  • Same results..I add the component onto tan app page and then added that app in Salesforce2. Its showing the same error on salesforce1 Feb 14 '19 at 10:03
  • I don't understand what is tan app page also Salesforce2, and what do you mean by Salesforce1 (is this the salesforce android or iphone app?). can you please explain how and where do you put this component Feb 14 '19 at 11:11
  • Sorry... that was a typo ...I add the component onto an app page and then added that app in Salesforce1. Its showing the same error on salesforce1. ... By Saleforce1; I meant the Salesforce Mobile app (android iphone app) Feb 14 '19 at 12:41
0

Can you remove the alert message in your controller and try it?

alert("Files uploaded : " + uploadedFiles.length);

if you like to display as count, then assign the variable and use to dispaly it in your components, rather than to show as a popup alert, sometime mobile is not supporting alert messages.

Please try it and revert your test results.

Thanks & Regards, ​​​​​​​Sakthivel Madesh

1
  • This is not an answer. It would appropriate to write this in comment. People may down vote your answer as your are not sure about the answer. Feb 13 '19 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.