Add document upload to Redact tool
api/extract.php — new endpoint accepting .pdf/.docx/.txt up to 4 MB; pdftotext for PDFs, ZipArchive+DOMXPath for DOCX, mb_convert_encoding for TXT; truncates to 32 000 chars to stay within redact limit. index.php — drop/browse upload zone above the textarea, visible only in Redact mode. tools.js — setupUpload(), handleFileUpload(), resetUpload(); drag-and-drop and file picker both call the extract endpoint then populate the textarea. tools.css — upload zone, drag-over, file-info, clear button styles. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -218,6 +218,19 @@ $authenticated = dbnToolsIsAuthenticated();
|
||||
<label><input type="radio" name="redactionRegion" value="global"> Global</label>
|
||||
</div>
|
||||
|
||||
<div class="upload-zone is-hidden" id="uploadZone" role="region" aria-label="File upload">
|
||||
<input type="file" id="uploadInput" accept=".pdf,.docx,.txt" aria-label="Choose a file">
|
||||
<div id="uploadPrompt" class="upload-prompt">
|
||||
<span class="upload-icon" aria-hidden="true">⇧</span>
|
||||
<p>Drop a <strong>.pdf</strong>, <strong>.docx</strong>, or <strong>.txt</strong>, or <label for="uploadInput" class="upload-browse">browse</label></p>
|
||||
<p class="upload-hint">Text is extracted and never stored.</p>
|
||||
</div>
|
||||
<div id="uploadFileInfo" class="upload-file is-hidden">
|
||||
<span id="uploadFileName" class="upload-filename"></span>
|
||||
<button type="button" id="uploadClear" class="upload-clear" aria-label="Clear uploaded file">×</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="input-label" for="toolInput" id="inputLabel">Question</label>
|
||||
<textarea id="toolInput" name="toolInput" rows="10" required></textarea>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user