Guest User

Untitled

a guest
Sep 5th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html><head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Bootstrap File Input Demo</title>
  6. <meta charset="utf-8">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.  
  9. <!-- jQuery -->
  10. <script src="h_files/jquery.js"></script>
  11.  
  12. <!-- Bootstrap 3 -->
  13. <link rel="stylesheet" href="h_files/bootstrap.css">
  14.  
  15. <script src="h_files/bootstrap.js"></script>
  16.  
  17. <style>
  18.  
  19. html,
  20. body {
  21. height: 100%;
  22. /* The html and body elements cannot have any padding or margin. */
  23. }
  24.  
  25. /* Wrapper for page content to push down footer */
  26. #wrap {
  27. min-height: 100%;
  28. height: auto !important;
  29. height: 100%;
  30. /* Negative indent footer by it's height */
  31. margin: 0 auto -60px;
  32. }
  33.  
  34. /* Set the fixed height of the footer here */
  35. #push,
  36. #footer {
  37. height: 60px;
  38. }
  39. #footer {
  40. background-color: #f5f5f5;
  41. }
  42.  
  43. /* Lastly, apply responsive CSS fixes as necessary */
  44. @media (max-width: 767px) {
  45. #footer {
  46. margin-left: -20px;
  47. margin-right: -20px;
  48. padding-left: 20px;
  49. padding-right: 20px;
  50. }
  51. }
  52.  
  53. .btn-file {
  54. position: relative;
  55. overflow: hidden;
  56. }
  57. .btn-file input[type=file] {
  58. position: absolute;
  59. top: 0;
  60. right: 0;
  61. min-width: 100%;
  62. min-height: 100%;
  63. font-size: 999px;
  64. text-align: right;
  65. filter: alpha(opacity=0);
  66. opacity: 0;
  67. background: red;
  68. cursor: inherit;
  69. display: block;
  70. }
  71. input[readonly] {
  72. background-color: white !important;
  73. cursor: text !important;
  74. }
  75. </style>
  76.  
  77. <script>
  78. $(document)
  79. .on('change', '.btn-file :file', function() {
  80. var input = $(this),
  81. numFiles = input.get(0).files ? input.get(0).files.length : 1,
  82. label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
  83. input.trigger('fileselect', [numFiles, label]);
  84. });
  85.  
  86. $(document).ready( function() {
  87. $('.btn-file :file').on('fileselect', function(event, numFiles, label) {
  88.  
  89. var input = $(this).parents('.input-group').find(':text'),
  90. log = numFiles > 1 ? numFiles + ' files selected' : label;
  91.  
  92. if( input.length ) {
  93. input.val(log);
  94. } else {
  95. if( log ) alert(log);
  96. }
  97.  
  98. });
  99. });
  100. </script>
  101. </head>
  102. <body >
  103. <div class="container" style="margin-top: 20px;">
  104. <div class="row">
  105.  
  106. <div class="col-lg-6 col-sm-6 col-12">
  107. <br><br><br><form action="index1.php" method="post">
  108. <div class="input-group">
  109. <span class="input-group-btn">
  110. <span class="btn btn-primary btn-file">
  111. Browse… <input name="file" id="file" type="file">
  112. </span>
  113. </span>
  114. <input value="" class="form-control" readonly="readonly" type="text">
  115. </div>
  116. <span class="help-block">
  117. Browse and select one text file
  118. </span><br><br>
  119. <input type="submit" name="submit" class="btn btn-success" value="Submit"/> </form>
  120. </div>
  121.  
  122.  
  123. </div>
  124. </div>
  125. <br><br>
  126. </div>
  127. <?
  128. if (isset($_POST['submit'])){
  129. if($_POST['submit']=='Submit'){
  130. //proccess;
  131. echo $_FILE['file']['name'].' test';
  132. }
  133.  
  134. }
  135. ?>
  136.  
  137. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment