open (LOCAL, ">$dir$file") or dieNicely("Unable to upload: $!"); while (read($file, $i, 1024)) { print LOCAL $i; } close (LOCAL);