Error using php code to upload a file

I am trying to use the code below to upload a file
<?php

$ path = “html/upload/”;

$path = $path . basename( $_FILES[‘userfile’][‘name’]);

if(move_uploaded_file($_FILES[‘userfile’][‘tmp_name’], $path)) {

echo “Success uploading”. basename($_FILES[‘userfile’][‘name’]);

} else{

echo “Error when uploading file.”;

}

?

I am using godaddy as to host my files.
my root directory is html. I created a folder called upload and uploaded the php file above and also the html file below

<form enctype=“multipart/form-data” action=“upload.php” method=“POST”>
Please choose a file: <input name=“userfile” type=“file” /><br />
<input type=“submit” value=“Upload” />
</form>

I am getting the error below when I try to use the form to upload a file.
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or ‘$’ in D:\Hosting\6995563\html\upload\upload.php on line 4

Can someone tell me where my error is

Does line 4 have this on it:


$ path = "html/upload/";

If so, remove the space between $ and ‘path’.

when I try to upload a file I am getting this error

Warning: move_uploaded_file(upload/Course Outline Junel 2009.pdf) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\Hosting\6995563\html\upload\upload.php on line 8

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘D:\Temp\php\phpE5E8.tmp’ to ‘upload/70291 Course Outline Junel 2009.pdf’ in D:\Hosting\6995563\html\upload\upload.php on line 8
Error when uploading file.

my form code is
<form enctype=“multipart/form-data” action=“upload.php” method=“POST”>
Please choose a file: <input name=“userfile” type=“file” /><br />
<input type=“submit” value=“Upload” />
</form>

my php code is
<?php

$path = “upload/”;

$path = $path . basename( $_FILES[‘userfile’][‘name’]);

if(move_uploaded_file($_FILES[‘userfile’][‘tmp_name’], $path)) {

echo “Success uploading”. basename($_FILES[‘userfile’][‘name’]);

} else{

echo “Error when uploading file.”;

}

?>

Can someone tell me what I am doing wrong. I created a dir on the hosting server called upload and place the two files upload.htm.l and upload.php in the folder. When I run the html form to upload the file I get the error message shown.

Check the value for $_FILES[‘userfile’][‘error’] what value is stored there? It will be an integer. The meaning of the code can be found here.