onFileUploaded( )


An event that triggers when a file has completed uploading.

The onFileUploaded() event handler runs when a file has been uploaded to to the Media Manager using the importFile(), upload() function, or the URL returned by the getUploadUrl() function.

The FileEvent object contains information about the uploaded file and the upload context.

Note: Backend events don't work when previewing your site.

Method Declaration
Copy
function onFileUploaded(event: FileEvent): void;
Method Parameters
eventFileEventRequired

The uploaded file information.

An event when a file has been uploaded
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixMediaManager_onFileUploaded(event) { let allFileInfo = event.fileInfo; let fileUrl = event.fileInfo.fileUrl; let mediaHeight = event.fileInfo.height; } /* Full event object: * { * "fileInfo": { * "mediaType": "image", * "height": 300, * "sourceUrl": "https://somedomain.com/img/original-name.jpg", * "mimeType": "image/jpeg", * "hash": "Ew00kXbu4Zt33rzjcWa6Ng==", * "opStatus": "READY", * "labels": [ * "Blue", * "Butterfly", * "Turquoise" * ], * "fileUrl": "wix:image://v1/f6c0f9_tg439f4475a749e181dd14407fdbd37e~mv2.jpg/original-name.jpg#originWidth=300&originHeight=300", * "originalFileName": "original-name.jpg", * "sizeInBytes": 51085, * "isPrivate": false, * "width": 300, * "iconUrl": "wix:image://v1/f6c0f9_tg439f4475a749e181dd14407fdbd37e~mv2.jpg/original-name.jpg#originWidth=300&originHeight=300", * "parentFolderId": "2bf470f5be194b319cdb2fvbu3278ff9" * }, * context: { * someKey1: "someValue1", * someKey2: "someValue2" * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?