I've been sitting with this for two days and Im all out of ideas.
What Im trying to do is to copy a file to a specified location using a form. But each time I get this error:
Warning: copy(../images/flowerpics/Untitled-1.jpg) [function.copy]: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/multiflora/admin/edit.php on line 10
Here is the form (I left out the excess fields):
Code: Select all
<form enctype="multipart/form-data" action="edit.php" method="post">
<table>
<tr><td>
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
<input name="flowerpic" type="file" />
</td></tr>
</table>
Code: Select all
<?php
session_start();
if ($_SESSION["loggedin"]!=true)
header("location:index.php?error=Please Log In First");
include 'include/openadmin.php';
include 'include/openflowerlist.php';
if ($_FILES['flowerpic']['name']!="")
{ copy($_FILES['flowerpic']['tmp_name'],
"../images/flowerpics/" . $_FILES['flowerpic']['name'])
or die("An error occurred while copying your file");
}
else { die ("No file specified"); }
$dbid=$_POST['dbid'];
$newid=$_POST['id'];
$newcommon=$_POST['common'];
$newbotanical=$_POST['botanical'];
$newcultivar=$_POST['cultivar'];
$newcolour=$_POST['colour'];
$newpic=$_FILES["flowerpic"]["name"];
$newjan=$_POST['jan'];
$newfeb=$_POST['feb'];
$newmar=$_POST['mar'];
$newapr=$_POST['apr'];
$newmay=$_POST['may'];
$newjun=$_POST['jun'];
$newjul=$_POST['jul'];
$newaug=$_POST['aug'];
$newsep=$_POST['sep'];
$newoct=$_POST['oct'];
$newnov=$_POST['nov'];
$newdec=$_POST['dec'];
$sql = "UPDATE `multiflora`.`flowerlist` SET `product id`='$newid', `common name`='$newcommon', `cultivar name`='$newcultivar', `botanical name`='$newbotanical', `colour`='$newcolour', `flower picture`='$newpic', `jan`='$newjan', `feb`='$newfeb', `mar`='$newmar', `apr`='$newapr', `may`='$newmay', `jun`='$newjun', `jul`='$newjul', `aug`='$newaug', `sep`='$newsep', `oct`='$newoct', `nov`='$newnov', `dec`='$newdec' WHERE `flowerlist`.`id` ='$dbid'";
mysql_query($sql) or die(mysql_error());
mysql_close($con);
mysql_close($flowercon);
header("location:adminlogin.php?msg=Update Successfull");
?>I've searched the net for solutions, but alas, nothing works....
Thank you in advance!