How do you return the URL of a file after it has been uploaded to a document library, using the default upload page? Returning the text from the "inputFile" textbox from the upload.aspx page would also work, but I can't figure out how to do that because it's loaded inside a modal dialog.

function uploadPicture(){
var currentUserDispName ='myname';
var options = {
    url: '/test/_layouts/15/Upload.aspx?List=6c7bc1b3%2D1b7f%2D466b%2Da0f5%2Dac15dc334ff7& RootFolder=/test/mydocs/' +      currentUserDispName + "&IsDlg=1",
    width: 450,
    height: 230,
    title: 'Upload a Picture',
    dialogReturnValueCallback: function(result, returnValue) {

    if (result == SP.UI.DialogResult.OK) {
          //get File URL
    else {                     
    }; SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);}

Why don't you build the URL to the item through JavaScript?

It appears you have all the components (like URL to the current site/subsite, document library, folder, and filename).

  • The problem is I can't get the filename to build the URL. – BarelyConfused Jan 15 '14 at 19:04

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.