Using PHP upload, avoid the writing of a temporary file,or change the tmp folder?

Hey guys, I am trying to write a script that will let me upload a file selected from a directory on my computer using PHP. I want to browse my PC and select a file which I can do, but when I select upload I get this error:

PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0

I think it may because I cannot create a temporary file on my server or my temp folder location is not the default? I looked at phpinfo on my server, which is a university server, and i saw that upload_tmp_dir was F:\Temp

Can I set my uploads to find this folder? I have a created a folder called uploaded which is where the final file needs to go, but I just cant get it to work. Any suggestions?

Here is my form:

<form enctype="multipart/form-data" action="ul.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />

And here is the action script:

<?php// Where the file is going to be placed
$target_path = "uploaded/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']).
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";


Is the directory writeable/readable?

Hi there, i do not know how I can tell if it is read/writable, can I tell from the phpinfo file?


In your FTP client or online file manager etc, you usually can right click on the directory to see the permissions set on it. It is expressed as three numbers, such as 646, 666, 777 etc.

I think I do not have access to that folder, I have sent an email to my admin, hopefully they can amend this issue so I can create my application. I appreciate your help with this.