How are running from the browser? The first snippet of code looks like JavaScript. Where is the Perl script running from? You can't run the Perl script from inside a browser with JavaScript. I am guessing that you can use JavaScript to make the browser do the upload.