You have use CGI, but apparently are not using CGI, since the part at the beginning does all the input processing itself?
Use strict and use warnings should always be on. The following variables are global and should have their scope set:
$BASE_PATH, $LINE, $bRead, $buffer, $content_type, $delete_file, $dir_name, $file_name, $folder, $interval, $len, $max_upload, $mes, $name, $ofh, $pair, $post_prog, $sessionid, $size, $submit, $user_dir, $user_level, $value, %form, @pairs
And there are various warnings as well, that I'm not going to bother fixing. You ought to be able to.
It's best to never lock the file you're trying to process. Hash (or add some suffix to) the file path, then create and lock a file with that hash as the file name. Do your processing on the file. Unlock the hash. This allows you to, for instance, open a file for read, read the number, close it, open the file for write, write the updated number, close it - without losing your lock. I really don't like the way you seem to be doing it.
As for overwriting your directory, I still haven't figured out why that's happening, but you might try printing all the paths you open for write or read/write and see if any of them is the wrong path. If that doesn't identify the problem, about all I can suggest is sectioning your program into a number of smaller subs with clearly identified input, output, and processing objectives, and testing each one to make sure it does what it's supposed to.
In reply to Re: Large upload files causing parent directory to be deleted
by TedPride
in thread Large upload files causing parent directory to be deleted
by clem_c_rock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |