File Uploads
Basic Usage
// wires/PhotoUpload.bx
class extends="cbwire.models.Component" {
data = {
"photo": "",
"isUploading": false
};
function save() {
if (data.photo != "") {
// Move file to permanent location
var storedPath = data.photo.store(expandPath("./uploads"));
// Clean up temporary file
data.photo.destroy();
// Reset form
data.photo = "";
}
}
}// wires/PhotoUpload.cfc
component extends="cbwire.models.Component" {
data = {
"photo" = "",
"isUploading" = false
};
function save() {
if (data.photo != "") {
// Move file to permanent location
var storedPath = data.photo.store(expandPath("./uploads"));
// Clean up temporary file
data.photo.destroy();
// Reset form
data.photo = "";
}
}
}How It Works
FileUpload Methods
File Content
Method
Description
File Information
Method
Description
File Locations
Method
Description
File Storage
Method
Description
Cleanup
Method
Description
Storing Files Permanently
Basic Usage
Store with Custom Filename
Automatic Directory Creation
Loading States
Handling Upload Errors
Method Signature
Parameter
Type
Description
Usage Example
When It's Called
Error Information
Last updated
Was this helpful?