/
githubmirror
/
localGPT
Обзор
Документация
Войти
/
githubmirror
/
localGPT
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/test-upload.html
54 строки
2 KB
Devin AI
feat: Update frontend file validation to accept MD, DOC, TXT, and HTML formats
22 июл 2025, 00:50
22 июл 2025, 00:50
8f3417a
Код
Авторство
О чём код?
<!DOCTYPE html> <html> <head> <title>Test PDF Upload</title> </head> <body> <h1>Test PDF Upload</h1> <form id="uploadForm"> <input type="file" id="fileInput" accept=".pdf,.docx,.doc,.html,.htm,.md,.txt" /> <button type="submit">Upload PDF</button> </form> <div id="result"></div> <script> document.getElementById('uploadForm').addEventListener('submit', async (e) => { e.preventDefault(); const fileInput = document.getElementById('fileInput'); const file = fileInput.files[0]; if (!file) { alert('Please select a file'); return; } console.log('Selected file:', { name: file.name, size: file.size, type: file.type, lastModified: file.lastModified }); const formData = new FormData(); formData.append('file_0', file); try { const response = await fetch('http://localhost:8000/sessions/4b545007-f13f-4bc8-be69-3f0633645e52/upload', { method: 'POST', body: formData }); const result = await response.json(); document.getElementById('result').innerHTML = '<pre>' + JSON.stringify(result, null, 2) + '</pre>'; console.log('Upload result:', result); } catch (error) { console.error('Upload failed:', error); document.getElementById('result').innerHTML = 'Upload failed: ' + error.message; } }); </script> </body> </html>