开发者

jQuery & PHP: Upload an image and refresh gallery page with new thumbnail

I have a page that contains thumbnails for a photo gallery. On this page is a link to upload more images. When you click the link a modal opens that contains an upload form (jquery colorbox in an iframe) which will allow you to upload one image (plus its name, caption, etc) at a time using PHP. When the form is submitted the image uploads and the page refreshes in the modal to allow for more uploads.

Since this modal is sitting on top of the existing thumbnails开发者_开发问答 I'd really like for the user to see the new thumbnail added to the page after it's uploaded. Is this possible? How would I do this?


I'm assuming the modal is in an iframe. If that's the case, when the upload is submitted, and the modal form reloads to allow for another upload, simply send the previously uploaded file info (thumbnail URL) back to the parent frame. For example:

parent.uploadCallback('http://my.domain.com/newly-uploaded-thumbnail.jpg');

Then have a uploadCallback function in the main frame which creates an img object and appends it to your list of thumbnails.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜