bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Eric Bidelman
My article "New Tricks in XMLHttpRequest2" has many fine examples, but what it doesn't have is any server code to illustrate how to handle files. If you're curious how to process a file upload using xhr.send(FormData), here's a quick example of an image upload in PHP.
This server is trivial but it demonstrates two things. The first is sending a file and extra payload at the same time. The second is how to grab the file (and other data) in PHP. Lastly, the image is encoded into a data: URL and included in a JSON response sent back to the client.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2012-04-17 UTC."],[],[]]