open(OUTFILE, ">$target_dir\/$Filename") || die "Error: Cannot open file"; undef $BytesRead; undef $Buffer; while ($read_bytes = read($Full_name,$Buffer,1024)) { #read file for uploading one K at a time $total_bytes += $read_bytes; print OUTFILE $Buffer; } $Confirmation{$Filename} = $total_bytes; close($Full_name); close(OUTFILE); chmod (0777, "$target_dir\/$Filename"); } } $max_filesize = "46080"; #45K $File = "$target_dir\/$Filename";