If case there is a thread already discussing this issue, my apology and please redirect me and I'll read up.
Anyway, I am writing CGI form which creates a new file in a solaris box. Numbers is the filename. There is a history file which stores the last number used. What can I do to make sure that the filename will not get clobbered? I am using following routine:
$fn_number = get_latest_filename(); # read the history file while ( -e $fn_number ) { $fn_number++; update_fn_number(); # update the history file } write_thefile($fn_number);
I tested with 3 users at the submitting the form at same time (well, I tried to make sure three of us clicking the submit button at the same time) and 1 out of 5 testing the form clobbers.
TY,
songahji
In reply to CGI filename race by songahji
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |