Uploading Files Over HTTP From Perl (Saturday, March 3rd, 2012) |
So it turns out that uploading files over HTTP from a perl script using LWP isn't as obvious and straightforward as you might expect it to be. This stuff should be plainly documented, and it's not. All the examples I could find online for how to do it are about ten years old and each of them is slightly wrong, in various different ways! So first off, yes, the right way to do this is probably # You MUST specify the boundary explicitly here. You can use whatever
Obviously you should choose the right MIME type for the type of file you're uploading, only use valid characters for the filename, and that sort of thing. I actually haven't tested this with binary data; I assume it works but it's possible there may be some escaping required somewhere that I've skipped here. Please let me know if you notice something I've missed, but this is working for me! |
Themes |
Random Quote |
“I'm not the person your mother warned you about... her imagination
isn't that good.”
- Amy Gorin |