purtuga / SPWidgets

Sharepoint Custom UI Widgets
74 stars 34 forks source link

SPControlUpload file.EncodedAbsUrl always returns 0 #74

Closed billyjimjack closed 7 years ago

billyjimjack commented 7 years ago

No matter what file I upload the file.EncodedAbsUrl always returns 0. Even though the file object is fully populated with the relevant information.

Here is my code: spcontroluploadinitcode

Here are the calls to load the required javascript: spcontroluploadloadedjs

Here is a screenshot of the alert returning '0': spcontroluploaddonealert

Here is a screenshot of the file attributes, at the point of the alert: spcontroluploadfileattr

purtuga commented 7 years ago

You must be coming from c# or .net :)

you need to use the + sign to concatenate two string together... not the &. So it should be:

alert("file url: " + file.EncodedAbsUrl);
billyjimjack commented 7 years ago

D'OH! Thanks for the help.