Results 1 to 3 of 3

Thread: How to upload & display image on same page?

  1. #1
    Join Date
    Dec 2008
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to upload & display image on same page?

    I've put together a page that allows a user to upload images. I also have put together a php class that creates thumbnails of the upload image(s). I want to upload the images, display the thumbnails on the same page, without reloading the page. I thought of using javascript (ajax) to check for the uploaded images, and then invoking the php thumbnail script via:

    Code:
    document.getElementById("displayData").innerHTML = 'thumbnails->display();';
    However, while I can insert the above into the target element nothing happens since the page hasn't reloaded/interacted with the server; and obviously if the page reloads the above js would be cleared. Anyone have suggestions on how to accomplish my goal?
    Last edited by dan0; 04-08-2009 at 07:26 PM.

  2. #2
    Join Date
    Dec 2008
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The solution was to have a trigger cause an ajax request and display the ajax response in the target element.

  3. #3
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    That sounds really cool. Post the code please!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •