0

I'm trying to store image in a variable.

eg. I'm creating a dynamic table where image upload is a part in that table

 $("#pdfFormInsideTblRight").after("<table class='table table-bordered'><thead class='thead-inverse'><tr><th class='text-left'>Properties</th>" +
                        "<th>Detail</th></tr></thead>" +
                        "<tr><td class='text-left'><strong>Product Group</strong></td>" +
    "<td><input type='file' id='flImage' name='flImage[]' multiple /></td>
</tr></table>");

and now i want to store the image uploaded above in variable 'flImage', in a variable 'user' like other inputs value from textbox and lables value are stored through jquery in var 'user' as given below

 <script type="text/javascript" src="http://cdn.jsdelivr.net/json2/0.1/json2.js"></script>
        <script type="text/javascript">
        $(function () {
            $(document).on("click", "[id*=btnFrmSubmit]", function () {
    var user = {};
                user.PRODUCT_ID = 1;
    user.REVISION = $("#Revision").text();
    user.P_GROUP = $("[id*=P_Group]").val();
    user.IMG1 = $("[id=flImage]")
     });
    }

but there is issue. Any idea would be appreciated how to do it.

hari
  • 93
  • 2
  • 11

1 Answers1

0

I think you want source of image tag. for getting this you should try like below code.

$("[id=flImage]").attr('src')
saddam
  • 771
  • 7
  • 23