I haven't tested your script (would have to create the HTML form etc), but the first thing that comes to mind is that "/home/canto8/~afrotc/public_html/tmp2/" isn't a valid path hence why it is unable to open the file. Are you sure this is the correct path, i.e. the tmp2 directory exists?