Title: WP3.5 Media Uploader [Problem]: Empty Javascript Objects
Last modified: August 20, 2016

---

# WP3.5 Media Uploader [Problem]: Empty Javascript Objects

 *  Resolved [adaldesign](https://wordpress.org/support/users/adaldesign/)
 * (@adaldesign)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp35-media-uploader-problem-empty-javascript-objects/)
 * I’m having issues using freshly uploaded images from the Media Uploader.
 * I’m using a [custom uploader frame and some simple jQuery as seen here](http://pastebin.com/EeiHHYSW).
 * As you can see on line 49 I wish to grab the URLs of thumbnail sizes for selected
   images and display them on the page after selection.
 * The code works fine… for previously uploaded files selected from the Media Library.
 * However the **attachment** object (see console log on line 52) is returning an
   empty object with undefined sizes for freshly uploaded files. If I click around,
   closing and reopening the Media Upload frame I can get it to work, but for the
   purpose of a functional app, it’s a failure.
 * I recorded [this video to help understand what’s going on](http://screenr.com/PSD7).
 * I sincerely hope someone has at least a pointer to give me on this problem, because
   I’ve been trying to solve it for a while now without success.
 * Thanks in advance,
    Adal

Viewing 1 replies (of 1 total)

 *  Thread Starter [adaldesign](https://wordpress.org/support/users/adaldesign/)
 * (@adaldesign)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/wp35-media-uploader-problem-empty-javascript-objects/#post-3464821)
 * So turns out the media uploader throws an empty object into the list when uploading
   new files… an issue I had encountered and fixed in the code right above, and 
   was the cause of problems for this purpose as well.
 * I was able to solve my problem by adding an if statement to exclude that empty
   object:
 *     ```
       // Show Thumbs
       var attachment_thumbs = selection.map( function( attachment ) {
         attachment = attachment.toJSON();
         if( attachment.id != '' ) { return '<img src="' + attachment.sizes.thumbnail.url + '" id="id-' + attachment.id + '" />'; }
       }).join(' ');
       $('#images-feedback').show();
       $('#thumbs').html(attachment_thumbs);
       ```
   
 * Although this solves my problem, I am still VERY curious as to why the media 
   uploader includes an empty object before freshly uploaded media…

Viewing 1 replies (of 1 total)

The topic ‘WP3.5 Media Uploader [Problem]: Empty Javascript Objects’ is closed to
new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [media](https://wordpress.org/support/topic-tag/media/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)
 * [upload](https://wordpress.org/support/topic-tag/upload/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 1 participant
 * Last reply from: [adaldesign](https://wordpress.org/support/users/adaldesign/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/wp35-media-uploader-problem-empty-javascript-objects/#post-3464821)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
