Week 7 – FileUploader

I spent some time last week trying to create a program that would allow users to upload different types of files using Amazon’s DynamoDB, so that it could be used later to create quiz banks. However, there was another part that I had to complete, which was to do the same thing, but instead to upload the files to S3 so they would be accessible from the main program, and in the form that we want.

This week was shorter than the others, so we had only 3 days to finish our weekly targets. I spent all three days trying to figure out how S3 worked – you would think that Amazon makes their technologies similar to each other, and therefore easy to learn when you already know how to use a different one, but no, they’re all different. I learned this the hard way when I tried running the entire program we had up to that point along with what I thought the solution should be – it gave me enough red signals to send me running back to do a better job.

I proceeded to try all kinds of solutions – tried uploading the files directly, changing the client I was using to upload the files to S3 (you wouldn’t think this should have been done, but due to technologies that were later deprecated, this turned out to be surprisingly helpful) , and even changing how the files were being uploaded – I tried them all. The point where I hit rock bottom, I think, was when I spent 2 hours trying to figure out how to convert a temporarily uploaded file to a byte stream using Amazon’s input API (Amazon is very finicky about the types of data you can upload and then have be accessible later), then figuring out it’s location and giving it full file status while trying to upload it to the database – it took a turn for the worse, and I was not a happy camper. However, I seemed to be on the right track as far as converting the input to a bytestream went – from there, it just became a matter of changing the file type of the recently uploaded file from a single part to a multipart, and remove all encoding so that the doPost method of the program would be able to understand the file that was being sent its way. Finally, I was able to accomplish what should have been nothing more than a 2-3 hour task!

Nope. There was still the matter of the client, and the HTML form through which the file was to be uploaded. I powered through the rest of what was to be done, and finished it barely 15 minutes before the last bus was to leave work – then ran downstairs, and made it onto the bus with seconds to spare.

This week was good, as I learned that programs never really get done in the timeframe you think they will – some don’t take very long, and some, like the one I tackled this week, take you a seriously long time.

Leave a Reply

Your email address will not be published. Required fields are marked *