Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import {getFileUrl, sendMail} from 'backend/attachment/process';
$w.onReady(function () {
});
export function upload_click(event) {
$w("#upload").disable();
let files = $w("#uploadButton1").value;
let fileName = files[0].name;
let fileType = /[^.]*$/.exec(fileName)[0];
$w("#uploadButton1").startUpload()
.then( (res) => {
let mediaId = res.mediaId;
getFileUrl(mediaId)
.then( (url) => {
let email = $w("#email").value;
let subject = $w("#subject").value;
let body = $w("#body").value;
let attachName = $w("#attName").value;
sendMail(url, email, subject, body, attachName, fileType)
.then( (res) => {
console.log(res);
$w("#upload").enable();
});
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment