Fix file uploading failed on certain server

Using absolute path for upload dir and fopen. On some server, fopen
fails to open relative path.