Download view_shared.php from Urban-Guy/Drive: direct link, hf CLI and curl.
- Browser
- Download file 10.9 kB
-
https://huggingface.co/spaces/Urban-Guy/Drive/resolve/main/view_shared.php
- Command line
-
hf download hf://spaces/Urban-Guy/Drive/view_shared.php
-
curl -L -o view_shared.php https://huggingface.co/spaces/Urban-Guy/Drive/resolve/main/view_shared.php
10.9 kB
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title> echo htmlspecialchars($fileName); - Shared File</title> | |
| <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet"> | |
| <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Roboto', sans-serif; | |
| background: #202124; | |
| color: #e8eaed; | |
| min-height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| .header { | |
| background: #292a2d; | |
| padding: 16px 24px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; | |
| box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); | |
| } | |
| .header-left { | |
| display: flex; | |
| align-items: center; | |
| gap: 16px; | |
| } | |
| .file-icon { | |
| width: 40px; | |
| height: 40px; | |
| background: #3c4043; | |
| border-radius: 8px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .file-icon .material-icons { | |
| font-size: 24px; | |
| color: #8ab4f8; | |
| } | |
| .file-info h1 { | |
| font-size: 20px; | |
| font-weight: 500; | |
| color: #e8eaed; | |
| margin-bottom: 4px; | |
| } | |
| .file-meta { | |
| font-size: 13px; | |
| color: #9aa0a6; | |
| } | |
| .header-actions { | |
| display: flex; | |
| gap: 12px; | |
| } | |
| .btn { | |
| padding: 10px 24px; | |
| border-radius: 4px; | |
| border: none; | |
| cursor: pointer; | |
| font-size: 14px; | |
| font-weight: 500; | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| transition: all 0.2s; | |
| } | |
| .btn-primary { | |
| background: #8ab4f8; | |
| color: #202124; | |
| } | |
| .btn-primary:hover { | |
| background: #aecbfa; | |
| } | |
| .btn-secondary { | |
| background: #3c4043; | |
| color: #e8eaed; | |
| } | |
| .btn-secondary:hover { | |
| background: #5f6368; | |
| } | |
| .viewer-container { | |
| flex: 1; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| padding: 24px; | |
| background: #17181a; | |
| } | |
| .viewer-content { | |
| max-width: 1200px; | |
| width: 100%; | |
| background: #292a2d; | |
| border-radius: 8px; | |
| overflow: hidden; | |
| box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); | |
| } | |
| .preview-area { | |
| background: #000; | |
| min-height: 500px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| position: relative; | |
| } | |
| .preview-area img { | |
| max-width: 100%; | |
| max-height: 80vh; | |
| object-fit: contain; | |
| } | |
| .preview-area video { | |
| width: 100%; | |
| max-height: 80vh; | |
| background: #000; | |
| } | |
| .preview-area iframe { | |
| width: 100%; | |
| height: 80vh; | |
| border: none; | |
| } | |
| .no-preview { | |
| text-align: center; | |
| padding: 60px 20px; | |
| color: #9aa0a6; | |
| } | |
| .no-preview .material-icons { | |
| font-size: 80px; | |
| margin-bottom: 16px; | |
| opacity: 0.5; | |
| } | |
| .no-preview h2 { | |
| font-size: 24px; | |
| margin-bottom: 8px; | |
| color: #e8eaed; | |
| } | |
| .no-preview p { | |
| font-size: 14px; | |
| margin-bottom: 24px; | |
| } | |
| .file-details { | |
| padding: 24px; | |
| border-top: 1px solid #3c4043; | |
| } | |
| .detail-row { | |
| display: flex; | |
| justify-content: space-between; | |
| padding: 12px 0; | |
| border-bottom: 1px solid #3c4043; | |
| } | |
| .detail-row:last-child { | |
| border-bottom: none; | |
| } | |
| .detail-label { | |
| color: #9aa0a6; | |
| font-size: 14px; | |
| } | |
| .detail-value { | |
| color: #e8eaed; | |
| font-size: 14px; | |
| font-weight: 500; | |
| } | |
| .play-button { | |
| width: 80px; | |
| height: 80px; | |
| background: rgba(138, 180, 248, 0.9); | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| cursor: pointer; | |
| transition: all 0.3s; | |
| } | |
| .play-button:hover { | |
| background: rgba(174, 203, 250, 0.9); | |
| transform: scale(1.1); | |
| } | |
| .play-button .material-icons { | |
| font-size: 48px; | |
| color: #202124; | |
| } | |
| @media (max-width: 768px) { | |
| .header { | |
| flex-direction: column; | |
| gap: 16px; | |
| } | |
| .header-actions { | |
| width: 100%; | |
| } | |
| .btn { | |
| flex: 1; | |
| justify-content: center; | |
| } | |
| .preview-area { | |
| min-height: 300px; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="header"> | |
| <div class="header-left"> | |
| <div class="file-icon"> | |
| <span class="material-icons">insert_drive_file</span> | |
| </div> | |
| <div class="file-info"> | |
| <h1><?php echo htmlspecialchars($fileName); ?></h1> | |
| <div class="file-meta"> | |
| <?php echo formatFileSize($fileSize); ?> • | |
| Shared by Drive | |
| </div> | |
| </div> | |
| </div> | |
| <div class="header-actions"> | |
| <a href="<?php echo htmlspecialchars($filePath); ?>" download="<?php echo htmlspecialchars($fileName); ?>" class="btn btn-primary"> | |
| <span class="material-icons">download</span> | |
| Download | |
| </a> | |
| </div> | |
| </div> | |
| <div class="viewer-container"> | |
| <div class="viewer-content"> | |
| <div class="preview-area"> | |
| <?php if (strpos($mimeType, 'image/') === 0): ?> | |
| <!-- Image Preview --> | |
| <img src="<?php echo htmlspecialchars($filePath); ?>" alt="<?php echo htmlspecialchars($fileName); ?>"> | |
| <?php elseif (strpos($mimeType, 'video/') === 0): ?> | |
| <!-- Video Preview --> | |
| <video controls autoplay> | |
| <source src="<?php echo htmlspecialchars($filePath); ?>" type="<?php echo htmlspecialchars($mimeType); ?>"> | |
| Your browser does not support the video tag. | |
| </video> | |
| <?php elseif (strpos($mimeType, 'audio/') === 0): ?> | |
| <!-- Audio Preview --> | |
| <div class="no-preview"> | |
| <span class="material-icons">music_note</span> | |
| <h2>Audio File</h2> | |
| <audio controls autoplay style="margin-top: 24px;"> | |
| <source src="<?php echo htmlspecialchars($filePath); ?>" type="<?php echo htmlspecialchars($mimeType); ?>"> | |
| </audio> | |
| </div> | |
| <?php elseif ($mimeType === 'application/pdf'): ?> | |
| <!-- PDF Preview --> | |
| <iframe src="<?php echo htmlspecialchars($filePath); ?>#toolbar=1"></iframe> | |
| <?php elseif (strpos($mimeType, 'text/') === 0): ?> | |
| <!-- Text Preview --> | |
| <div style="width: 100%; height: 600px; overflow: auto; padding: 24px; background: #1e1e1e; color: #d4d4d4; font-family: 'Courier New', monospace;"> | |
| <pre><?php echo htmlspecialchars(file_get_contents($filePath)); ?></pre> | |
| </div> | |
| <?php else: ?> | |
| <!-- No Preview Available --> | |
| <div class="no-preview"> | |
| <span class="material-icons">insert_drive_file</span> | |
| <h2>No preview available</h2> | |
| <p>This file type cannot be previewed.</p> | |
| <a href="<?php echo htmlspecialchars($filePath); ?>" download="<?php echo htmlspecialchars($fileName); ?>" class="btn btn-primary"> | |
| <span class="material-icons">download</span> | |
| Download to view | |
| </a> | |
| </div> | |
| <?php endif; ?> | |
| </div> | |
| <div class="file-details"> | |
| <div class="detail-row"> | |
| <span class="detail-label">File name</span> | |
| <span class="detail-value"><?php echo htmlspecialchars($fileName); ?></span> | |
| </div> | |
| <div class="detail-row"> | |
| <span class="detail-label">Type</span> | |
| <span class="detail-value"><?php echo htmlspecialchars($mimeType); ?></span> | |
| </div> | |
| <div class="detail-row"> | |
| <span class="detail-label">Size</span> | |
| <span class="detail-value"><?php echo formatFileSize($fileSize); ?></span> | |
| </div> | |
| <div class="detail-row"> | |
| <span class="detail-label">Modified</span> | |
| <span class="detail-value"><?php echo date('M d, Y', $modifiedTime); ?></span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Handle video play button if needed | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const video = document.querySelector('video'); | |
| if (video) { | |
| video.addEventListener('loadedmetadata', function() { | |
| console.log('Video loaded successfully'); | |
| }); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> | |
| // Define formatFileSize here if it doesn't exist | |
| if (!function_exists('formatFileSize')) { | |
| function formatFileSize($bytes) { | |
| if ($bytes >= 1073741824) { | |
| return number_format($bytes / 1073741824, 2) . ' GB'; | |
| } elseif ($bytes >= 1048576) { | |
| return number_format($bytes / 1048576, 2) . ' MB'; | |
| } elseif ($bytes >= 1024) { | |
| return number_format($bytes / 1024, 2) . ' KB'; | |
| } else { | |
| return $bytes . ' bytes'; | |
| } | |
| } | |
| } | |