Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had a similar problem sometime back when I was new to this API. I found a link at that time, which helped me understand a lot of things about this. <a href="http://tutorialzine.com/2012/11/dropbox-photo-crop/" rel="nofollow">Here's the link to that.</a> </p> <p>What the link says is, for accessing the <code>event.files[0]</code>, you'd have to check in <code>event.originalEvent</code>, not <code>event</code>. So, your code would look something like this :</p> <pre><code>$("#db-chooser").on('DbxChooserSuccess',function(event) { alert("Here's the chosen file: " + event.originalEvent.files[0].link) } </code></pre> <p>What actually happens is, when an event is initialised, jQuery copies almost all properties of the <code>originalEvent</code> (JS event) and creates its own <code>event</code> wrapper with custom properties. Along with it, it stores the <code>originalEvent</code> as a property so that some left out properties (such as <code>files[0]</code> in your case) can be accessed later. <a href="http://api.jquery.com/category/events/event-object/" rel="nofollow">From the jQuery Site</a> :</p> <blockquote> <p>jQuery’s event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler. Most properties from the original event are copied over and normalized to the new event object.</p> </blockquote> <p>That's why your <code>files[0]</code> property doesn't exist in jQuery's event. Hope this helps.</p> <p><strong>PS</strong> : There's a lot of nice stuff in that link. Do check it out :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload