File Upload and Management
Letting people send you files without opening a hole in your portal
Sooner or later someone needs to send you a document. A contract, a screenshot of the error, a signed form. Do this badly and you’ve got a security problem, a storage bill and a support queue full of “the upload didn’t work”.
Power Pages handles files through Dataverse, and the integration is decent. What it won’t do for you is decide what’s safe to accept or tell the user what’s happening while a 40MB PDF crawls up their home connection.
Step by step
1. Set up the upload
Start with a custom table to track file metadata - you’ll want somewhere to record who uploaded what and when. The bytes themselves go in a file column on the same row:
// File Upload Entity Configuration
const fileUploadEntity = {
schemaName: 'cr5f3_fileupload',
displayName: 'File Upload',
fields: [
{
name: 'cr5f3_file',
type: 'file',
displayName: 'File'
},
{
name: 'cr5f3_filename',
type: 'string',
displayName: 'File Name',
required: true,
maxLength: 255
},
{
name: 'cr5f3_description',
type: 'string',
displayName: 'Description',
maxLength: 500
},
{
name: 'cr5f3_filesize',
type: 'integer',
displayName: 'File Size (bytes)',
required: true
},
{
name: 'cr5f3_filetype',
type: 'string',
displayName: 'File Type',
required: true,
maxLength: 50
},
{
name: 'cr5f3_uploaddate',
type: 'datetime',
displayName: 'Upload Date',
required: true
},
{
name: 'cr5f3_uploadedby',
type: 'lookup',
displayName: 'Uploaded By',
target: 'contact',
required: true
},
{
name: 'cr5f3_status',
type: 'optionset',
displayName: 'Status',
options: [
{ value: 1, label: 'Pending' },
{ value: 2, label: 'Validated' },
{ value: 3, label: 'Approved' },
{ value: 4, label: 'Rejected' }
]
},
{
name: 'cr5f3_category',
type: 'optionset',
displayName: 'Category',
options: [
{ value: 1, label: 'Document' },
{ value: 2, label: 'Image' },
{ value: 3, label: 'Contract' },
{ value: 4, label: 'Report' },
{ value: 5, label: 'Other' }
]
}
]
};
The Web API writes a file column with a PUT to /_api/<entityset>(id)/<column> and takes up to 16 MB in a single call, so a 10 MB client-side limit sits comfortably inside that. The row has to exist before the file goes in, which is why the upload below is two calls. The table and the file column need Web API site settings, and the web role needs create and write on the table.
Then the form itself. The container carries the signed-in contact’s ID from Liquid, and the error box is where rejected files are listed:
<!-- Advanced File Upload Form -->
<div class="file-upload-container" id="fileUploadContainer" data-contact-id="{{ user.id }}">
<form class="file-upload-form" id="fileUploadForm">
<!-- Upload Area -->
<div class="upload-zone" id="uploadZone">
<div class="upload-zone-content">
<div class="upload-icon">📁</div>
<h3>Drag & Drop Files Here</h3>
<p>or <button type="button" class="btn-link" id="browseFiles">browse files</button></p>
<div class="upload-restrictions">
<small>Supported formats: PDF, DOC, DOCX, XLS, XLSX, JPG, PNG, GIF</small>
<small>Maximum file size: 10MB per file</small>
<small>Maximum 5 files per upload</small>
</div>
</div>
<input type="file" id="fileInput" name="files" multiple accept=".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif" style="display: none;">
</div>
<div class="upload-errors" id="uploadErrors" role="alert"></div>
<!-- File Preview Area -->
<div class="file-preview-area" id="filePreviewArea" hidden>
<h4>Selected Files</h4>
<div class="file-list" id="fileList"></div>
<!-- Bulk Actions -->
<div class="bulk-actions">
<div class="form-group">
<label for="bulkCategory">Category for all files:</label>
<select id="bulkCategory" name="bulkCategory">
<option value="">Select category</option>
<option value="1">Document</option>
<option value="2">Image</option>
<option value="3">Contract</option>
<option value="4">Report</option>
<option value="5">Other</option>
</select>
</div>
<div class="form-group">
<label for="bulkDescription">Description (optional):</label>
<textarea id="bulkDescription" name="bulkDescription" rows="3"
placeholder="Add a description for these files..."></textarea>
</div>
</div>
<!-- Upload Controls -->
<div class="upload-controls">
<button type="button" class="btn btn-secondary" id="clearFiles">
Clear All
</button>
<button type="submit" class="btn btn-primary" id="uploadFiles" disabled>
<span class="btn-text">Upload Files</span>
<span class="btn-spinner" style="display: none;">⟳</span>
</button>
</div>
</div>
<!-- Upload Progress -->
<div class="upload-progress-container" id="uploadProgressContainer" hidden>
<h4>Upload Progress</h4>
<div class="overall-progress">
<div class="progress-bar">
<div class="progress-fill" id="overallProgressFill" style="width: 0%"></div>
</div>
<span class="progress-text" id="overallProgressText">0%</span>
</div>
<div class="file-progress-list" id="fileProgressList"></div>
</div>
<!-- Upload Results -->
<div class="upload-results" id="uploadResults" hidden>
<div class="results-summary" id="resultsSummary"></div>
<div class="results-details" id="resultsDetails"></div>
<button type="button" class="btn btn-primary" id="uploadMore">
Upload More Files
</button>
</div>
</form>
</div>
2. Wire up the client side
Drag and drop, progress feedback, the works. Each file becomes two Web API calls: a POST that creates the metadata row, then a PUT that streams the bytes into its file column. Both carry the __RequestVerificationToken header from shell.getTokenDeferred().
class FileUploadHandler {
constructor(containerSelector) {
this.container = document.querySelector(containerSelector);
this.uploadZone = this.container.querySelector('#uploadZone');
this.fileInput = this.container.querySelector('#fileInput');
this.filePreviewArea = this.container.querySelector('#filePreviewArea');
this.fileList = this.container.querySelector('#fileList');
this.uploadForm = this.container.querySelector('#fileUploadForm');
this.uploadButton = this.container.querySelector('#uploadFiles');
this.errorBox = this.container.querySelector('#uploadErrors');
this.progressContainer = this.container.querySelector('#uploadProgressContainer');
this.progressList = this.container.querySelector('#fileProgressList');
this.resultsContainer = this.container.querySelector('#uploadResults');
this.contactId = this.container.dataset.contactId;
this.items = [];
this.maxFileSize = 10 * 1024 * 1024; // 10MB
this.maxFiles = 5;
this.allowedTypes = [
'application/pdf',
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'image/jpeg',
'image/png',
'image/gif'
];
this.setupEventListeners();
this.setupDragAndDrop();
}
setupEventListeners() {
this.container.querySelector('#browseFiles').addEventListener('click', () => this.fileInput.click());
this.fileInput.addEventListener('change', (e) => this.handleFileSelection(Array.from(e.target.files)));
this.uploadForm.addEventListener('submit', (e) => {
e.preventDefault();
this.startUpload();
});
this.container.querySelector('#clearFiles').addEventListener('click', () => this.clearFiles());
this.container.querySelector('#uploadMore').addEventListener('click', () => this.reset());
}
setupDragAndDrop() {
const stop = (e) => {
e.preventDefault();
e.stopPropagation();
};
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(name => {
this.uploadZone.addEventListener(name, stop);
document.body.addEventListener(name, stop);
});
['dragenter', 'dragover'].forEach(name => {
this.uploadZone.addEventListener(name, () => this.uploadZone.classList.add('drag-over'));
});
['dragleave', 'drop'].forEach(name => {
this.uploadZone.addEventListener(name, () => this.uploadZone.classList.remove('drag-over'));
});
this.uploadZone.addEventListener('drop', (e) => {
this.handleFileSelection(Array.from(e.dataTransfer.files));
});
}
handleFileSelection(newFiles) {
const errors = [];
newFiles.forEach(file => {
if (this.items.length >= this.maxFiles) {
errors.push(`${file.name}: maximum ${this.maxFiles} files per upload`);
return;
}
const error = this.validateFile(file);
if (error) {
errors.push(`${file.name}: ${error}`);
return;
}
this.items.push({ id: crypto.randomUUID(), file, category: '', description: '' });
});
this.errorBox.textContent = errors.join('. ');
this.updateFilePreview();
}
// Returns an error message, or null when the file is fine
validateFile(file) {
if (!this.allowedTypes.includes(file.type)) {
return 'File type not allowed. Supported formats: PDF, DOC, DOCX, XLS, XLSX, JPG, PNG, GIF';
}
if (file.size > this.maxFileSize) {
return `File size exceeds ${this.formatFileSize(this.maxFileSize)} limit`;
}
if (this.items.some(item => item.file.name === file.name && item.file.size === file.size)) {
return 'File already selected';
}
return null;
}
formatFileSize(bytes) {
return bytes < 1024 * 1024
? `${Math.round(bytes / 1024)} KB`
: `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
}
updateFilePreview() {
const hasFiles = this.items.length > 0;
this.filePreviewArea.hidden = !hasFiles;
this.uploadButton.disabled = !hasFiles;
this.fileList.replaceChildren(...this.items.map(item => this.createFilePreviewItem(item)));
}
createFilePreviewItem(item) {
const row = document.createElement('div');
row.className = 'file-item';
row.innerHTML = `
<div class="file-info">
<div class="file-details">
<div class="file-name"></div>
<div class="file-meta"></div>
</div>
</div>
<div class="file-controls">
<div class="file-fields">
<select class="file-category">
<option value="">Select category</option>
<option value="1">Document</option>
<option value="2">Image</option>
<option value="3">Contract</option>
<option value="4">Report</option>
<option value="5">Other</option>
</select>
<input type="text" class="file-description" placeholder="Description (optional)" maxlength="500">
</div>
<button type="button" class="btn-remove" aria-label="Remove file">✕</button>
</div>
`;
// File names come from the user: set them as text, never as HTML
row.querySelector('.file-name').textContent = item.file.name;
row.querySelector('.file-meta').textContent = `${this.formatFileSize(item.file.size)} • ${item.file.type}`;
row.querySelector('.btn-remove').addEventListener('click', () => this.removeFile(item.id));
row.querySelector('.file-category').addEventListener('change', (e) => { item.category = e.target.value; });
row.querySelector('.file-description').addEventListener('input', (e) => { item.description = e.target.value; });
return row;
}
removeFile(id) {
this.items = this.items.filter(item => item.id !== id);
this.updateFilePreview();
}
clearFiles() {
this.items = [];
this.fileInput.value = '';
this.errorBox.textContent = '';
this.updateFilePreview();
}
reset() {
this.clearFiles();
this.resultsContainer.hidden = true;
this.progressContainer.hidden = true;
this.uploadZone.hidden = false;
}
async startUpload() {
if (this.items.length === 0) return;
// Hide the preview and the drop zone, not the form: the progress bars live inside it
this.filePreviewArea.hidden = true;
this.uploadZone.hidden = true;
this.progressContainer.hidden = false;
this.updateOverallProgress(0);
this.progressList.replaceChildren(...this.items.map(item => this.createProgressRow(item)));
const results = [];
let completed = 0;
// One at a time, so a slow connection gets one honest progress bar instead of five stalled ones
for (const item of this.items) {
try {
const recordId = await this.uploadSingleFile(item, (p) => this.updateFileProgress(item.id, p));
results.push({ item, recordId, success: true });
} catch (error) {
results.push({ item, error, success: false });
}
completed++;
this.updateOverallProgress((completed / this.items.length) * 100);
}
this.showUploadResults(results);
}
createProgressRow(item) {
const row = document.createElement('div');
row.className = 'file-progress';
row.id = `file-progress-${item.id}`;
row.innerHTML = `
<span class="file-name"></span>
<div class="progress-bar"><div class="progress-fill" style="width: 0%"></div></div>
<span class="progress-text">0%</span>
`;
row.querySelector('.file-name').textContent = item.file.name;
return row;
}
// The anti-forgery token Power Pages expects on every Web API call
getToken() {
return new Promise((resolve, reject) => {
shell.getTokenDeferred().done(resolve).fail(reject);
});
}
async uploadSingleFile(item, progressCallback) {
// 1. Create the row
const create = await fetch('/_api/cr5f3_fileuploads', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'__RequestVerificationToken': await this.getToken()
},
body: JSON.stringify({
cr5f3_filename: item.file.name,
cr5f3_filesize: item.file.size,
cr5f3_filetype: item.file.type,
cr5f3_uploaddate: new Date().toISOString(),
cr5f3_category: parseInt(item.category || '5', 10), // default to Other
cr5f3_status: 1, // Pending
cr5f3_description: item.description,
'cr5f3_uploadedby@odata.bind': `/contacts(${this.contactId})`
})
});
if (!create.ok) throw new Error(`Could not create the record (${create.status})`);
const recordId = create.headers.get('entityid');
// 2. Put the bytes in the file column; XMLHttpRequest because fetch has no upload progress
const token = await this.getToken();
await new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.upload.addEventListener('progress', (e) => {
if (e.lengthComputable) progressCallback((e.loaded / e.total) * 100);
});
xhr.addEventListener('load', () => {
if (xhr.status >= 200 && xhr.status < 300) {
resolve();
} else {
reject(new Error(`Upload failed with status ${xhr.status}`));
}
});
xhr.addEventListener('error', () => reject(new Error('Upload failed due to a network error')));
xhr.open('PUT', `/_api/cr5f3_fileuploads(${recordId})/cr5f3_file`);
xhr.setRequestHeader('Content-Type', 'application/octet-stream');
xhr.setRequestHeader('__RequestVerificationToken', token);
xhr.send(item.file);
});
return recordId;
}
updateFileProgress(fileId, progress) {
const row = document.getElementById(`file-progress-${fileId}`);
if (!row) return;
row.querySelector('.progress-fill').style.width = `${progress}%`;
row.querySelector('.progress-text').textContent = `${Math.round(progress)}%`;
if (progress >= 100) row.classList.add('completed');
}
updateOverallProgress(progress) {
this.container.querySelector('#overallProgressFill').style.width = `${progress}%`;
this.container.querySelector('#overallProgressText').textContent = `${Math.round(progress)}%`;
}
showUploadResults(results) {
const summary = this.container.querySelector('#resultsSummary');
const details = this.container.querySelector('#resultsDetails');
const failed = results.filter(r => !r.success).length;
this.progressContainer.hidden = true;
this.resultsContainer.hidden = false;
summary.textContent = failed === 0
? `${results.length} file(s) uploaded`
: `${results.length - failed} uploaded, ${failed} failed`;
details.replaceChildren(...results.map(result => {
const row = document.createElement('div');
row.className = `result-item ${result.success ? 'success' : 'error'}`;
const name = document.createElement('div');
name.className = 'result-filename';
name.textContent = result.item.file.name;
const message = document.createElement('div');
message.className = 'result-message';
message.textContent = result.success ? 'Upload successful' : result.error.message;
row.append(name, message);
if (result.success) {
const link = document.createElement('a');
link.className = 'btn-link';
link.target = '_blank';
link.textContent = 'View file';
link.href = `/_api/cr5f3_fileuploads(${result.recordId})/cr5f3_file/$value`;
row.append(link);
}
return row;
}));
}
}
new FileUploadHandler('#fileUploadContainer');
If the PUT fails, the metadata row still exists without a file. Either delete it in the catch or let the status column tell the story; the example does neither.
The progress bar isn’t decoration. Without it people upload the same file four times because nothing appeared to happen.
3. Give people somewhere to manage their files
<!-- File Management Dashboard -->
<div class="file-management-dashboard">
<div class="dashboard-header">
<h2>My Files</h2>
<div class="dashboard-actions">
<button type="button" class="btn btn-primary" id="openUpload">
📤 Upload Files
</button>
<div class="view-toggle">
<button class="btn btn-outline active" data-view="grid">⊞ Grid</button>
<button class="btn btn-outline" data-view="list">☰ List</button>
</div>
</div>
</div>
<div class="dashboard-filters">
<div class="filter-group">
<label for="categoryFilter">Category:</label>
<select id="categoryFilter" class="filter-select">
<option value="">All Categories</option>
<option value="1">Documents</option>
<option value="2">Images</option>
<option value="3">Contracts</option>
<option value="4">Reports</option>
<option value="5">Other</option>
</select>
</div>
<div class="filter-group">
<label for="statusFilter">Status:</label>
<select id="statusFilter" class="filter-select">
<option value="">All Status</option>
<option value="1">Pending</option>
<option value="2">Validated</option>
<option value="3">Approved</option>
<option value="4">Rejected</option>
</select>
</div>
<div class="filter-group">
<label for="dateFilter">Date Range:</label>
<select id="dateFilter" class="filter-select">
<option value="">All Time</option>
<option value="7">Last 7 days</option>
<option value="30">Last 30 days</option>
<option value="90">Last 3 months</option>
</select>
</div>
<div class="search-group">
<input type="text" id="searchFiles" placeholder="Search files..." class="search-input">
<button type="button" class="search-btn">🔍</button>
</div>
</div>
<div class="files-container" id="filesContainer">
<div class="files-grid" id="filesGrid">
<!-- Files will be populated here -->
</div>
</div>
<div class="pagination-container" id="paginationContainer">
<!-- Pagination will be populated here -->
</div>
</div>
4. Process on the server
Power Automate for virus scanning, conversion and anything else that shouldn’t run in the browser. The way in is the When Power Pages calls a flow trigger: build the flow from the Set up workspace under Cloud flows, add it to the site with the web roles allowed to call it, and the site hands you a URL to post to. Only solution-aware flows can be attached.
The flow takes the record ID as a text input, reads the row and the file column, runs the scan, writes cr5f3_status back as Validated or Rejected, and emails the uploader. The address comes from emailaddress1 on the contact row the lookup points to; the lookup’s display value is the contact’s name, not an email address.
Calling it after a successful upload:
// The GUID is the one shown for the flow under Cloud flows in the Set up workspace
shell.ajaxSafePost({
type: 'POST',
url: '/_api/cloudflow/v1.0/trigger/00000000-0000-0000-0000-000000000000',
data: { eventData: JSON.stringify({ RecordId: recordId }) }
})
.done(() => console.log('Scan requested'))
.fail(() => console.warn('Flow call failed; the file stays Pending'));
The input name in eventData has to match the parameter name defined on the trigger.
Client-side file type checks are a user convenience. The server-side check is the control - anyone can rename a file.
What this looks like in practice
A document portal:
/* Document Management Portal Styling */
.file-management-dashboard {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
.dashboard-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 2px solid #e9ecef;
}
.dashboard-actions {
display: flex;
gap: 1rem;
align-items: center;
}
.view-toggle {
display: flex;
border: 1px solid #e9ecef;
border-radius: 6px;
overflow: hidden;
}
.view-toggle button {
border: none;
border-radius: 0;
padding: 0.5rem 1rem;
}
.view-toggle button.active {
background: var(--primary-color);
color: white;
}
.dashboard-filters {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
padding: 1.5rem;
background: #f8f9fa;
border-radius: 8px;
}
.filter-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.filter-group label {
font-weight: 600;
font-size: 0.875rem;
color: #495057;
}
.filter-select, .search-input {
padding: 0.5rem;
border: 1px solid #ced4da;
border-radius: 4px;
font-size: 0.875rem;
}
.search-group {
display: flex;
gap: 0.5rem;
}
.search-btn {
padding: 0.5rem 1rem;
background: var(--primary-color);
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
.files-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 1.5rem;
}
.file-card {
background: white;
border: 1px solid #e9ecef;
border-radius: 8px;
padding: 1.5rem;
transition: all 0.3s ease;
cursor: pointer;
}
.file-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
border-color: var(--primary-color);
}
.file-card-header {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1rem;
}
.file-type-icon {
font-size: 2rem;
width: 50px;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
background: #f8f9fa;
border-radius: 8px;
}
.file-info h4 {
margin: 0 0 0.25rem 0;
font-size: 1rem;
font-weight: 600;
color: #212529;
word-break: break-word;
}
.file-meta {
font-size: 0.75rem;
color: #6c757d;
}
.file-status {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 500;
margin-bottom: 1rem;
}
.file-status.approved {
background: #d4edda;
color: #155724;
}
.file-status.pending {
background: #fff3cd;
color: #856404;
}
.file-status.rejected {
background: #f8d7da;
color: #721c24;
}
.file-actions {
display: flex;
gap: 0.5rem;
justify-content: flex-end;
}
.file-actions button {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
border: 1px solid #e9ecef;
background: white;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s ease;
}
.file-actions button:hover {
background: #f8f9fa;
border-color: var(--primary-color);
}
.file-actions .btn-primary {
background: var(--primary-color);
color: white;
border-color: var(--primary-color);
}
.pagination-container {
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
margin-top: 2rem;
padding-top: 2rem;
border-top: 1px solid #e9ecef;
}
.pagination {
display: flex;
gap: 0.25rem;
}
.pagination button {
padding: 0.5rem 0.75rem;
border: 1px solid #e9ecef;
background: white;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s ease;
}
.pagination button:hover {
background: #f8f9fa;
border-color: var(--primary-color);
}
.pagination button.active {
background: var(--primary-color);
color: white;
border-color: var(--primary-color);
}
.pagination button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Upload Zone Styling */
.upload-zone {
border: 2px dashed #ced4da;
border-radius: 8px;
padding: 3rem 2rem;
text-align: center;
background: #f8f9fa;
transition: all 0.3s ease;
cursor: pointer;
}
.upload-zone:hover,
.upload-zone.drag-over {
border-color: var(--primary-color);
background: #e7f3ff;
}
.upload-zone-content {
max-width: 400px;
margin: 0 auto;
}
.upload-icon {
font-size: 3rem;
margin-bottom: 1rem;
opacity: 0.7;
}
.upload-zone h3 {
margin: 0 0 0.5rem 0;
color: #495057;
}
.upload-zone p {
margin: 0 0 1rem 0;
color: #6c757d;
}
.btn-link {
background: none;
border: none;
color: var(--primary-color);
text-decoration: underline;
cursor: pointer;
font-size: inherit;
}
.upload-restrictions {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.upload-restrictions small {
color: #6c757d;
font-size: 0.75rem;
}
/* File Preview Styling */
.file-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
border: 1px solid #e9ecef;
border-radius: 6px;
margin-bottom: 0.75rem;
background: white;
}
.file-info {
display: flex;
align-items: center;
gap: 1rem;
flex: 1;
}
.file-icon {
font-size: 1.5rem;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: #f8f9fa;
border-radius: 6px;
}
.file-name {
font-weight: 600;
color: #212529;
margin-bottom: 0.25rem;
}
.file-meta {
font-size: 0.75rem;
color: #6c757d;
}
.file-controls {
display: flex;
align-items: center;
gap: 1rem;
}
.file-fields {
display: flex;
gap: 0.5rem;
}
.file-category {
min-width: 120px;
padding: 0.25rem 0.5rem;
border: 1px solid #ced4da;
border-radius: 4px;
font-size: 0.75rem;
}
.file-description {
min-width: 150px;
padding: 0.25rem 0.5rem;
border: 1px solid #ced4da;
border-radius: 4px;
font-size: 0.75rem;
}
.btn-remove {
width: 30px;
height: 30px;
border: 1px solid #dc3545;
background: white;
color: #dc3545;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.875rem;
transition: all 0.2s ease;
}
.btn-remove:hover {
background: #dc3545;
color: white;
}
How to make a mess and fix it
Work down this list:
- File size limits - check both client and server, they’re usually different
- File type validation - make sure MIME checking is consistent on both sides
- Virus scanning - verify the integration runs
- Storage permissions - Dataverse entity permissions and Azure storage access
- Network timeouts - big files on slow connections need generous limits
- Progress tracking - if the bar lies, people retry
- Error messages - say which rule was broken, not “upload failed”
Wrapping up
Files need the same care as any other user input, plus a bit more: validate on both sides, tell people what’s happening, and handle failure gracefully. Get that right and document-driven processes become pleasant.
Useful links
- Enable attachments on a form
- Configure notes as attachments
- Enable Azure Storage for attachments
- Upload files to Azure Blob Storage with the Web API
- Configure a file column
- Web API write, update and delete operations
- Configure cloud flows in Power Pages
Next: advanced portal management - users, roles, and the administration side.