Results 1 to 4 of 4

Thread: Uploading image without page refresh?

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

    Question Uploading image without page refresh?

    I want to create an edit page that allows the user to select an image and insert/update that image into a database, and upon successful insertion of the image, immediately display that image in the edit page all without refreshing/reloading the page. I'm pretty sure AJAX can't do what I've described. Does anyone know how to do it? Examples/tutorials would be appreciated. Thanks.

  2. #2
    Join Date
    Nov 2008
    Posts
    19
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    A good question, please let me inform when you get an ans.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    AJAX in and of itself cannot do all of that. A bit of server side stuff would need to be going on. However, AJAX could probably be set up with some javascript to monitor the progress of a request or repeated request for the image uploaded as an image element object. The combination of the request returning 4 and/or the image element object's signaling load or complete status shouldn't happen until the image is available, at which point it could be displayed.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Question

    I got the image file to upload to the server without refreshing the entire page by using an iframe, below is the code.

    Code:
    <form name="ImgForm" id="ImgForm" enctype="multipart/form-data" method="post" action="image_upload.php" target="imgUploadFrame">
        <label class="label">Upload Picture:<br/>
        <input type="file" name="imgFile" id="imgFile" /><input type="submit" name="saveImg" value="Save" /></label>
    </form>
    <iframe name="imgUploadFrame" id="imgUploadFrame"></iframe>
    However, I'm having trouble with displaying the image once the file is successfully uploaded.

    AJAX could probably be set up with some javascript to monitor the progress of a request or repeated request for the image uploaded as an image element object.
    Could you give an example of the above?

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
  •