summaryrefslogtreecommitdiff
path: root/posts/programming/2021-01-28-undefined-javasript-is-undefined-.html
diff options
context:
space:
mode:
Diffstat (limited to 'posts/programming/2021-01-28-undefined-javasript-is-undefined-.html')
-rw-r--r--posts/programming/2021-01-28-undefined-javasript-is-undefined-.html10
1 files changed, 6 insertions, 4 deletions
diff --git a/posts/programming/2021-01-28-undefined-javasript-is-undefined-.html b/posts/programming/2021-01-28-undefined-javasript-is-undefined-.html
index 8ff3e7c..d4b8f11 100644
--- a/posts/programming/2021-01-28-undefined-javasript-is-undefined-.html
+++ b/posts/programming/2021-01-28-undefined-javasript-is-undefined-.html
@@ -97,7 +97,8 @@
<p>
You can see what the debugging logs looked like on the backend below.
Note that the <code>&data</code> is the field that spells out
- "undefined".
+ "undefined". Also note that the file picker/FormData was constructed
+ alright because the key for the image name is correct.
</p>
<pre>
@@ -136,16 +137,17 @@ ImageWrite("The image format could not be determined")
<code>
let file = event.target.files[0];
if (!file) {
-return;
+ return;
}
const fd = new FormData();
fd.append(file.name, file);
const response = await fetch("http://localhost:8000/photos", {
-method: "POST",
-body: fd
+ method: "POST",
+ body: fd
});
+
console.log(response);
</code>
</pre>