I've managed to upload a file using the code below
<a onclick="openDialog(); return false;" href="#">Open Attach File</a>
<script type="text/javascript">
function openDialog() {
var options= {
url: "<blahblahblah>/_layouts/Upload.aspx?List={blahblahblah}&RootFolder=",
title: "Attach File",
};
SP.UI.ModalDialog.showModalDialog(options);
}
</script>
My question is how do I change the filename retroactively?