Why file inputs refresh doesn't work?

Why file inputs refresh doesn't work?

  1. <?php
  2. print "<div data-role='fieldset' id='upload'>";
  3. print "<input type='hidden' name='MAX_FILE_SIZE' value='500000'/>";
  4. // print "<div data-role='fieldcontain'>";
  5. // print "<label for='upload[]'>add one img:</label>";
  6. // print "<input type='file' name='upload[]' id='upload1'>";
  7. // print "</div>";
  8. print "<button type='button' id='addUp' name='addUp' data-inline='true'>add a file upload</button>";
  9. print "<button type='button' id='delUp' name='delUp' data-inline='true'>del</button>";
  10. print "</div>";
  11. ?>

my js file
  1. $(function(){
  2.   $("#addUp").click(function() {
  3.     /* Act on the event */
  4.     $("#upload").append("<div data-role='fieldcontain'><label for='upload[]'>upload:</label><input type='file' name='upload[]' id='upload1'></div>");
  5.     // $("#addUp").trigger('create');       // this doesn't work.no css
  6.     $("input[type='file']").textinput("refresh");      // this doesn't work.no css
  7.   });