📁 IrbyImaging/Views/LegalImaging/Upload.cshtml
Description
This Razor view provides a user interface for uploading one or more files within the Legal Imaging area of the IrbyImaging application. It leverages native HTML file inputs, optional Dropzone.js integration, a loading overlay with a spinner, and posts the files to theUploadDocsaction on theLegalImagingcontroller.
📖 Table of Contents
- Overview & Purpose
- Key Functional Areas
- Dependencies & Technologies
- View Model & Routing Context
- UI Structure & Markup
- JavaScript Behavior & Helpers
- Loading Overlay & Spinner
- Sample Usage Flow
- Conclusion & Next Steps
🧐 Overview & Purpose
This view, Upload.cshtml, is designed to let legal staff upload supporting documents (e.g., PDFs, images) in bulk. Key objectives:
- Browse or drag‑and‑drop multiple files simultaneously.
- Show a progress spinner during upload.
- Post data to the back‑end endpoint
LegalImaging/UploadDocswith an optionalcategoryparameter. - Optionally integrate with Dropzone.js for an improved drag‑and‑drop experience.
🧩 Key Functional Areas
| Area | Description |
|---|---|
| Page Metadata | Sets page title, layout, and breadcrumb via ViewBag. |
| File Upload Form | Native <input type="file" multiple> wrapped in Html.BeginForm. |
| Dropzone.js Integration | (Commented out) configuration to enable advanced drag‑and‑drop. |
| Loading Overlay & Spinner | Displays progress feedback during upload using [spin.js]. |
| Scripts & Styles | References to jQuery, Bootstrap, Dropzone, spin.js, and custom app scripts. |
🔧 Dependencies & Technologies
- ASP.NET MVC Razor
- jQuery (~/assets/libs/jquery/jquery.min.js)
- Bootstrap 4 (~/assets/libs/bootstrap/js/bootstrap.bundle.min.js)
- MetisMenu, SimpleBar, Waves (page utilities)
- Dropzone.js (CDN) — optional, commented out
- spin.js (~/assets/js/spin.js)
- Custom CSS (~/assets/libs/dropzone/min/dropzone.min.css)
📐 View Model & Routing Context
This view does not expose a strongly‑typed model. Instead, it uses:
@{
var category = ViewBag.category; // Category passed via query string or controller
}
The form posts to:
@using (Html.BeginForm(
actionName: "UploadDocs",
controllerName: "LegalImaging",
routeValues: new { category = category },
method: FormMethod.Post,
htmlAttributes: new { enctype = "multipart/form-data" }))
{
<!-- file inputs & submit button -->
}
👀 UI Structure & Markup
-
Header & Layout
ViewBag.Title = "Form File Upload"; Layout = "~/Views/Shared/_LegalLayout.cshtml"; -
Styles Section
@section styles{ <link href="~/assets/libs/dropzone/min/dropzone.min.css" rel="stylesheet" /> } -
File Picker
<div class="row mb-4"> <i class="display-5 text-muted bx bxs-cloud-upload"></i> <label class="col-form-label col-lg-3">Browse or Drop Files to Upload...</label> <div class="col-lg-12"> <input class="form-control" name="file" type="file" multiple /> </div> </div> -
Submit Button
<button id="submitbtn" type="submit" class="btn btn-primary"> Upload Documents </button> -
Loading Overlay
<div id="loading"> <div id="loadingcontent"> <p id="loadingspinner"> Upload in progress. Please wait..... </p> </div> </div>
🛠️ JavaScript Behavior & Helpers
1. Dropzone Configuration (Optional)
Currently commented out. Enable by uncommenting and matching the form to
.dropzone.
Dropzone.options.dropzoneForm = {
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
init: function () {
var dz = this;
$("#uploadfile").click(() => dz.processQueue());
dz.on("complete", file => {
window.location.href =
'@Url.Action("DocPreview","Imaging")?fileName=' + file.name;
});
}
};
2. Loading Spinner via spin.js
$(function () {
$("#submitbtn").click(function () {
$("#loading").fadeIn();
var opts = {
lines: 19, length: 28, width: 7, speed: 2.0,
color: '#11467e', animation: 'spinner-line-shrink'
};
new Spinner(opts).spin(document.getElementById('loading'));
});
});
🔄 Sample Usage Flow
- User navigates to
/LegalImaging/Upload?category=Contracts. - View renders the file picker UI.
- User clicks Browse, selects multiple files.
- User clicks Upload Documents (
#submitbtn). - Loading overlay appears with spinner.
- Form posts multipart data to
POST /LegalImaging/UploadDocs?category=Contracts. - Controller handles files, saves to disk/database, then returns a redirect or JSON.
- View hides spinner or redirects to a preview page.
✅ Conclusion & Next Steps
- Extend this view by re‑enabling Dropzone.js for richer UX.
- Implement server‑side validation or size/type checks in
UploadDocs. - Enhance error handling: display validation messages on the page.
- Integrate with a progress bar or percentage indicator via AJAX.
🚀 Result: A flexible, multi‑file upload form tailor‑made for the Legal Imaging workflow in IrbyImaging!