存储,更新,删除,预览图像

I'm trying to retrieve the image from DB even when clicked on refresh.

Javascript function:

function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();
                reader.onload = function (e) {
                    $('#blah')
                        .attr('src', e.target.result)
                        .width(50)
                        .height(50);
                };
                reader.readAsDataURL(input.files[0]);
            }
        }

Now when i choose the file, i will get a small thumbnail, but when i refresh, there will be no image. Functionality i'm trying to achieve,

  • Upload a file, show a preview small. - which is done.
  • When i refresh it has to be there, since i'm concentrating on only one ID at the moment.

This application is to store,update,delete an image[while previewing all the time in a small thumbnail]. I'm using Normal PHP here, where as the app is in CodeIgniter.

EDIT: All need is to ECHO the last uploaded image src.

You are not saving the file to the server, so when you refresh, you are just blowing away all of the JavaScript variables that are holding the data.