-2

i have button where i will browse images and in jquery i am trying to set that browsed images value to hidden input type file .I have tried so many example but i could not able to fix it.In php side i am getting null values.

HTML

    <button type="button" value="" id="activityAddOrEditfakeBrowse" onclick="invokeBrowseButtonClick('activityAddOrEditFile');" class="btn btn-primary btn-xs"><i class="fa fa-upload"></i>Upload Documents</button>

 <div id="section2"><!-- for dynamic controls-->
                              </div>

JQUERY

  var fileCnt = 0;

$('#activityAddOrEditFile').on('change', function(){ 

 var $input = $("<input name='croppedDocumentActivity[]' type='file' id='croppedDocumentActivity"+ (fileCnt + 1) +"' value="+file.name+" class='croppedDocumentActivity'>");
                        fileCnt++;
$('#section2').append($input);
scott
  • 3,112
  • 19
  • 52
  • 90

1 Answers1

0

you can try this:

<input type="hidden" value="filename.ext" />;
<script>;
  $(function () {
    $("button").on("click", function (event) {
      e.preventDefault();
      $(".hidden-control").attr("type", "text");
      $("form").submit();
    });
  });
</script>;
bansal kapil
  • 445
  • 1
  • 3
  • 13