Skip to content

@gaurav /
Last active

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
A small cookbook program showing how to upload files with Perl
use strict;
use warnings;
# This is intended as an easy-to-use cookbook example to getting started
# uploading files on Perl. Please let me (gaurav at ggvaidya dot com) know
# if you have any comments or suggestions for this example.
# It is made available under the same license terms as the Perl interpreter.
use WWW::Mechanize;
my $mech = new WWW::Mechanize(
autocheck => 1 # If set to 1, WWW::Mechanize will produce its
# own error messages.
# For more information on how $file works, please check out
# see
my $file = [
'filename-on-disk.txt', # The file you'd like to upload.
'filename-for-upload.txt', # The filename you'd like to give the web server.
'Content-type' => 'text/plain' # Any other flags you'd like to add go here.
'Content_Type' => 'form-data',
'Content' => [
'upload' => $file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.