Oof... One at a time. First, the previously selected image disappears because the innerHTML gets just that- the innerHTML. This does not include a value for the upload field (that's stored elsewhere for the moment), so it spits it out as empty. You'd have to get the value of the upload box(es), save them in Javascript, do your innerHTML stuff, then ...