Possible to use SPLookupAddNew to upload a document?

Jan 21, 2014 at 8:33 PM
I have a list with a lookup column pointing to a document library. Some of the users are asking if they can upload the reference file from the list form rather than having to go upload to the library first, then link it in the list (sigh...).

The closest thing I've found is SPLookupAddNew in SPServices, but while I "get it" for adding items to a lookup list, adding files to a library seems a trickier proposition. Has anyone implemented something like this before, either with SPServices/SPLookupAddNew or another way?
Jan 21, 2014 at 9:50 PM
The easiest thing to do would be to add a button onto the form that opens the upload dialog to the library. Once the user is finished uploading and tagging the document, a callback can be fired (dialogReturnValueCallback). That callback could then use SPServices to find the latest document uploaded by the current user and populate a control on the original form. I've done this a few times and it works great.

There is one drawback to this though... If the user has overwrite existing files selected, the created date of the existing file will not be updated and you'll get inconsistent results. It's easy to toggle that off and disable it altogether though.

Cheers,
Matthew