Guest User

Untitled

a guest
Jan 16th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. <div class="col">
  2. <div class="input-group">
  3. <label class="input-group-btn">
  4. <span class="btn" style="background-color:#3BAFDA;">
  5. Subir foto.<input type="file" accept="image/*" name="img_martillo" class="form-control" id="img_martillo" style="display: none;" capture>
  6. </span>
  7. </label>
  8. <input type="text" class="form-control" readonly>
  9. </div>
  10.  
  11. $nombre_img_martillo=$_FILES['img_martillo']['name']; //Obtiene el nombre de la img.
  12. $archivo_img_martillo=$_FILES['img_martillo']['tmp_name']; //Contiene el archivo.
  13. $ruta_img_martillo="files/".$nserie;
  14.  
  15. if (!file_exists($ruta_img_canon)) {
  16. mkdir($ruta_img_martillo);
  17. }
  18. $ruta_img_martillo=$ruta_img_martillo."/".$nombre_img_martillo; //files/nombre.jpg
  19. move_uploaded_file($archivo_img_martillo, $ruta_img_martillo);
  20.  
  21. <script type="text/javascript">
  22. $(function() {
  23.  
  24. // We can attach the `fileselect` event to all file inputs on the page
  25. $(document).on('change', ':file', function() {
  26. var input = $(this),
  27. numFiles = input.get(0).files ? input.get(0).files.length : 1,
  28. label = input.val().replace(/\/g, '/').replace(/.*//, '');
  29. input.trigger('fileselect', [numFiles, label]);
  30. });
  31.  
  32. // We can watch for our custom `fileselect` event like this
  33. $(document).ready( function() {
  34. $(':file').on('fileselect', function(event, numFiles, label) {
  35.  
  36. var input = $(this).parents('.input-group').find(':text'),
  37. log = numFiles > 1 ? numFiles + ' files selected' : label;
  38.  
  39. if( input.length ) {
  40. input.val(log);
  41. } else {
  42. if( log );
  43. }
  44.  
  45. });
  46. });
  47.  
  48. });
Add Comment
Please, Sign In to add comment