hi ive got a standard form. with a file upload thingo. the form all work properly except for when i try to copy the image from the temperary storage into a permanent storage. here is my code below:
<?php
if ($submit)
{
if ($file == 'none')
$file = '';
if ($file)
{
echo $file;
var_dump($HTTP_POST_FILES);
$picture = $HTTP_POST_FILES['file']['name'];
$destination = "moviePictures/$file";
if (file_exists($destination) && (!$overwrite))
{
?>
<p>
The picture <?php echo $picture ?> already exists.<br>
Do you want to overwrite?
</p>
<p>
<form method='post' name='check' action='<?php echo $PHP_SELF ?>?page=addMovie'>
<?php notedata(); $stop = 1; ?>
<input name='' type="reset" onClick="history.go(-1); return true;" value="No!">
<input name='overwrite' type='submit' value='Yes'>
</p>
</form>
<?php
}
else
copy($HTTP_POST_FILES['file']['tmp_name'], $destination);
}
$addQuery = "INSERT INTO movies (name, description, rating, picture) VALUES ('$name', '$description', '$rating', '$destination')";
mysql_query($addQuery) or die(mysql_error());
?>
<table width="640" border="0" cellpadding="10" cellspacing="2">
<tr>
<td width="200" height="55" valign="top"><img src="images/addMovie.gif" width="200" height="55"></td>
<td width="440"> </td>
</tr>
<tr>
<td width="616" height="450" valign="middle" align="center"><p>Movie Added Successfully</p></td>
</tr>
</table>
<?php
}
else
{
<table width="640" border="0" cellpadding="10" cellspacing="2">
<!--DWLayoutTable-->
<tr>
<td width="200" height="55" valign="top"><img src="images/addMovie.gif" width="200" height="55"></td>
<td width="440"> </td>
</tr>
<tr>
<form name="addMovie" method="post" action="<?php echo $PHP_SELF ?>?page=addMovie">
<td height="41" valign="middle" align="right">Name:</td>
<td valign="top"><input type="text" name="name">
</td>
</tr>
<tr>
<td height="39" valign="middle" align="right">Rating:</td>
<td valign="top">
<select name="rating">
<option selected value=""> </option>
<option value="G">G</option>
<option value="PG">PG</option>
<option value="M">M</option>
<option value="MA">MA</option>
<option value="R">R</option>
</select>
</td>
</tr>
<tr>
<td height="146" valign="middle" align="right">Description</td>
<td valign="top"><textarea name="description" cols="40" rows="6"></textarea></td>
</tr>
<tr>
<td height="34" valign="middle" align="right">Picture:</td>
<td valign="top"><input name="file" type="file" size="45"></td>
</tr>
<tr>
<td height="49"> </td>
<td valign="top"><input type="reset" name="Reset" value="Reset"> <input type="submit" name="submit" value="Submit"></form></td>
</tr>
<tr>
<td height="42"> </td>
<td> </td>
</tr>
</table>
i get the error "Warning: Unable to open '' for reading: Permission denied in c:\phpdev\www\public\hood\addMovie.php on line 31"
I did a var dump on the $HTTP_POST_FILES array and it has nothing in it?? someone please help. Also the $file variable has the address of the file on the person's computer.