Replace link used for "upload files"

Forums vLooup for SharePoint Replace link used for "upload files"

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 2 weeks, 5 days ago.

  • Author
    Posts
  • #18764

    chgrnet
    Participant

    Is there a way to replace the link used for “upload files” when using vLookup to add files to a document library? I find that using a link to a web part page with the folder associate with the task is much better and would like for that to be the link used instead of the default upload file screen.

    What I did was create a web part page with a web part of the document library. I hid everything else on the page except for the section that shows the files and allows you to add new files. I have a folder manually created before files can be uploaded (I only allow files to be uploaded into a folder, not individually) for other processes. Because each task has one specific folder, I can tell the link for my web part page to open the correct folder where additions/removals can occur.

  • #18847

    Alexander Bautz
    Keymaster

    Hi,
    You can override the upload function used when you hover over a folder and click the blue upload icon by adding this in the custom js:

    spjs.vLookup.uploadToFolder = function(fin,url){
    	var o = {"autoSize":true};
    	spjs.vLookup.data.refreshThisField = fin;
    	url = "YOUR_CUSTOM_UPLOAD_URL";
    	SP.UI.ModalDialog.commonModalDialogOpen(url,o,spjs.vLookup.uploadCallback);
    };

    Change “YOUR_CUSTOM_UPLOAD_URL” with your custom URL.

    If it’s the “New document” button, you can override it like this:

    jQuery("#newItemWrap_vLookupDocuments").html("<span onclick='spjs.vLookup.uploadToFolder(\"vLookupDocuments\",\"\");'>New document</span>");

    Change “vLookupDocuments” with the name of your field.

    Alexander

You must be logged in to reply to this topic.