Activity Forums Salesforce® Discussions Multiple files select and Drag&Drop multiple files upload in salesforce?

  • Multiple files select and Drag&Drop multiple files upload in salesforce?

    Posted by Subba Salesforce on December 18, 2017 at 1:33 PM

    Hi Is there is any approach or app for Select multiple files While uploading , drag&drop multiple files(Both functionalities should be supported) and which supports all the latest browsers like Chrome,Internet Explorer,Mozilla,Edge,Safari etc..Once the files are uploaded there should be an option to change the Description field?

    Manpreet replied 8 years ago 2 Members · 1 Reply
  • 1 Reply
  • Manpreet

    Member
    January 17, 2018 at 4:08 AM

    Hi,
    1) Add the main script to a js file and add it to static resource.

    2) Create a new Custom Link.

    3) Reference the js file in the custom link you created in the previous step. We will also need jQuery, so we will add that as well.

    4) Add that custom link a home page component of type Links.

    5) Add the home page component to the home page layout and you’re done. For more details on this hacking method, you can check this link here

    So here we go: ->

    1) Create a javascript file with the below code and add it as a static resource with the name attachmentjs

    jQuery(function(){

    /*Checks when the notes and attachment section is loaded and then initiates the process.*/
    var timeInterval = setInterval(function(){
    if(jQuery("div.bRelatedList[id$=RelatedNoteList]").find("div.pbHeader").find("td.pbButton").find("input[name=attachFile]").length > 0){
    addAttachButton();
    clearInterval(timeInterval);
    }
    },100);

    });

    /*Adds the drop zone div in the notes and attachment section. Event listener are added to listen when files are dropped in the zone.*/
    function addAttachButton() {

    var attachmentDiv = jQuery("div.bRelatedList[id$=RelatedNoteList]");
    insertButton();

    attachmentDiv.find("div.pbHeader").find("td.pbButton").after(
    jQuery("

    ", {
    style : "width:35%;cursor:pointer;"
    }).append(jQuery("",{
    style : "height: 30px; width: px;border-color: orange;border: 3px solid orange;border-style: dotted;border-radius: 4px;text-align: center;vertical-align: middle;line-height: 2;color: Red;font-family: monospace;font-size: 14px;",
    id : "dropDiv"
    }).append(jQuery("",{id:"clickHere"}).text('Drop files here / click here!') , jQuery("",{id:"uploadingMessage",style:"display:none;"}).text('Uploading your Files, please wait!'))
    )
    );

    jQuery("#dropDiv").on('click',function(){
    if(jQuery("#uploadingMessage:hidden").length > 0) {
    if(jQuery("#multiUploadButton").length > 0) {
    jQuery("#multiUploadButton")[0].click();
    }else {
    insertButton();
    jQuery("#multiUploadButton")[0].click();
    }
    } else {
    alert('Your files are being uploaded. Please Wait!');
    }
    });

    function handleFileSelect(evt) {
    evt.stopPropagation();
    evt.preventDefault();
    var files = evt.dataTransfer.files; // FileList object.
    processFiles(files);
    }
    function handleDragOver(evt) {
    evt.stopPropagation();
    evt.preventDefault();
    evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
    }

    var dropZone = document.getElementById('dropDiv');
    dropZone.addEventListener('dragover', handleDragOver, false);
    dropZone.addEventListener('drop', handleFileSelect, false);
    }

    function processFiles(files) {
    hideDiv();
    var insertedFilesArray = [];
    var fileInsertionCounter = 0;

    for(i=0;i

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos