EDIT - It must run when the user submits, I would prefer to avoid an Ajax call if possible,
I'm having a problem sending a file to the server using the Javascript FormData object. While posting everything here will obfuscate the issue and prompt a lot of 'why didn't you do this?' questions.
As part of my interface, a user drags and drops a file onto a part of the web page. This prompts the following code to run:
var data = new FormData();
if (selectedFile != null) {
data.append(selectedFile.name, selectedFile);
}
$('#myForm').submit();
The above code works correctly, other than the problem that I am having. While the rest of the form is submitted properly, I am not getting the file I am trying to upload - I know this because I looked at the entirety of the network request, and it simply wasn't there. There's no (obvious, at least) bug here, but there must be something that I am overlooking, forgetting, or simply don't know how to do.
FWIW, this is part of a drag and drop file submittal interface where for one reason or another the ones that I tried were not suitable.