Assuming you are talking about Linux you could use the
flock()
[
^] function. However, you still need to know the full path to the file. Also worth checking are the directory permissions where you are trying to create this file; does the user have write permission?