Advertisement
myarkqub

Untitled

Nov 12th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. Html
  2. <div class="file-input-container">
  3. <label for="excelFile" class="custom-file-upload">Choose Excel File</label>
  4. <input type="file" id="excelFile" accept=".xlsx" style="display:none;">
  5. <span id="fileName" class="file-name">No file chosen</span>
  6. </div>
  7.  
  8. Css
  9. .file-input-container {
  10. margin-bottom: 20px;
  11. text-align: center;
  12. }
  13.  
  14. .custom-file-upload {
  15. display: inline-block;
  16. padding: 10px 20px;
  17. font-size: 1.1em;
  18. color: #fff;
  19. background-color: #007bff;
  20. border: none;
  21. border-radius: 5px;
  22. cursor: pointer;
  23. transition: background-color 0.3s ease, box-shadow 0.3s ease;
  24. margin-right: 10px;
  25. }
  26.  
  27. .custom-file-upload:hover {
  28. background-color: #0056b3;
  29. box-shadow: 0px 4px 12px rgba(0, 123, 255, 0.3);
  30. }
  31.  
  32. .file-name {
  33. font-size: 1em;
  34. color: #333;
  35. vertical-align: middle;
  36. }
  37.  
  38. Js
  39. document.getElementById("excelFile").addEventListener("change", function() {
  40. const fileName = document.getElementById("fileName");
  41. if (this.files.length > 0) {
  42. fileName.textContent = this.files[0].name;
  43. } else {
  44. fileName.textContent = "No file chosen";
  45. }
  46. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement