0

just a quick question. I'm stuck trying to find out if this is possible but what I have is a form that a user can enter information about a product. I'm saving the information entered by the user in a session variable. When the user hits the submit button the form doesn't submit it into the database but it takes them to a review page. The user can then review their entered details and once happy they will finalise it from that new page. The user can select a file(image) in the first form which I need it to display as an image on the second page.(review page)

I know this code will display an image once the user selects a file. But how, if possible, can I display this image on the second page?

JS

  function readURL(input) {

  if (input.files && input.files[0]) {
    var reader = new FileReader();

    reader.onload = function (e) {
        $('#blah').attr('src', e.target.result);
    }

    reader.readAsDataURL(input.files[0]);
}
}

$("#imgInp").change(function(){
readURL(this);
});

HTML

<form id="form1" runat="server">
<input type='file' id="imgInp" />
<img id="blah" src="#" alt="your image" />
</form>

So like I said, this will show the image as soon as the user selects the file, but I need to use

<img id="blah" src="#" alt="your image" /> 

on the second page?

Any ideas? A million thanks in advance

Peter

1 Answers1

0

Well,Question seems to have more then one ideas at once

You can not store this at the client side So First,You can store that image into a temp folder and the if use confirms his submissions then copy into your main folder Also,Second

you can convert this image into a base64 or byte to session and then display by converting this values to image and make sure that this sessions getting null after submission of user

I am sharing you a link which will help you to accomplish

https://stackoverflow.com/a/12396875/2630817

Storing image path in a variable

Community
  • 1
  • 1
Just code
  • 13,553
  • 10
  • 51
  • 93
  • 1
    be carefull storing payload in the session, especially on clustered infrastructure – john Smith Jun 18 '14 at 10:15
  • What do you mean john smith? Storing payload? Sorry I'm just a student, but I'm learning at a fast rate... Thanks just code, I did see that post but I was unsure what or how to use it. I will look at it again. Thanks for your help.... – Peter Brennan Jun 18 '14 at 10:40
  • @PeterBrennan please find some tutorials and do your self – Just code Jun 18 '14 at 10:42