#UPLOAD THE FILE/PICTURE my $outfile ="/home/path/$tempID.jpg"; open(OUT,">$outfile") || die "Could not read $outfile, $!"; my $data; my $size = 0; my $total_size = 0; binmode $file; binmode OUT; while ($size = read($file,$data,16384)) { print OUT $data; $total_size += $size; } close OUT;