Re: Permission Denied; Upload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You need to give the user permission to write in the destination directory,
you can do this by using:
 chmod 666 directoryname


"John" <johnx@inetgenesis.com> escribió en el mensaje
001501c2fad5$b1624260$0100a8c0@John">news:001501c2fad5$b1624260$0100a8c0@John...
Thanking in advance,

Hi all- very new to php, and at the risk of being "spoon fed" here, I beg
for your patience in advance.  I am trying to have an entry page for user
input/ pic upload into MySQL/win2k (www.sammiesmodels.com/entry.php ).

I get this error during test of the above page:  Warning: Unable to open ''
for reading: Permission denied in C:\SammiWWW\entry.php on line 27 Couldn't
copy the file!

The upload folder, "Temp" sits in the root www dir, and the user has all
permissions granted (or do i?) in the DB.  Below is the syntax to the
"Entry" page:

***************************************************
<html>
<head>
<title>Portfolio Entry </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFEBEB">
<?php
if ($submit) {

  $db=mysql_connect("66.220.69.20","admin","snoddy");
  mysql_select_db("sammies models",$db);
  $sql="INSERT INTO models (first, last, age, email, location, eye, hair,
experience, aspirations, mtype, picname1, picname2, picname3, picname4,
picname5, picname6, picname7, picname8)
  VALUES
('$first','$last','$age','$email','$location','$eye','$hair','$experience','
$aspirations','$mtype','$picname1','$picname2','$picname3','$picname4','$pic
name5','$picname6','$picname7','$picname8')";
  mysql_query($sql) or die(mysql_error());

// if $_FILES['img1'] isn't empty, try to copy the file
if ($_FILES['picname1'] != "") {

 // copy the file to a directory or
 file://die and print an error message

 // NOTE! if you're on a Windows machine,
 // use Windows pathnames, like so:
 // copy($_FILES[picname1][$first],
"C:\\sammiwww\\directory\\path\\".$_POST[img1_name]);

 copy($_FILES['picname1']['$first . temp'],
"C:\\sammiwww\\upload\\".$_FILES['picname1']['$first'])
  or die("Couldn't copy the file!");

} else {

 // if $_FILES['picname1'] was empty, die and let us know why
 die("No input file specified");

}

?>


    echo "First: $first<br>\n";
    echo "Last: $last<br>\n";
    echo "Age: $age<br>\n";
    echo "Email: $email<br>\n";
    echo "Location: $location<br>\n";
 echo "Eye color: $eye<br>\n";
 echo "Hair color: $hair<br>\n";
 echo "Experience: $experience<br>\n";
 echo "Aspirations: $aspirations<br>\n";
 echo "Media Type: $mtype<br>\n";
 echo "Photo 1: $picname1<br>\n";
 echo "<img src=c:/sammiwww/pic/$picname1><br>\n";
 echo "Photo 2: $picname2<br>\n";
 echo "<img src=c:/sammiwww/pic/$picname2><br>\n";
    echo "Photo 3: $picname3<br>\n";
 echo "<img src=c:/sammiwww/pic/$picname3><br>\n";
    echo "Photo 4: $picname4<br>\n";
 echo "<img src=c:/sammiwww/pic/$picname4><br>\n";
    echo "Photo 5: $picname5<br>\n";
 echo "<img src=c:/sammiwww/pic/$picname5><br>\n";
 echo "Photo 6: $picname6<br>\n";
 echo "<img src=c:/sammiwww/pic/$picname6><br>\n";
 echo "Photo 7: $picname7<br>\n";
 echo "<img src=c:/sammiwww/pic/$picname7><br>\n";
 echo "Photo 8: $picname8<br>\n";
    echo "<img src=c:/sammiwww/pic/$picname8><br>\n";
  echo  "<b><center>Thank you for registering,&nbsp; $first
</b></center><p>";
 ?>
 <p><center></p>
<center>
<a href="http://www.sammiesmodels.com"; target="_self">Return to Sammies
Models
Home</a>
<? }
   // display form
else {
  ?>
</center>
<center>
<font face="Georgia, Times New Roman, Times, serif"><strong>Submit Your
Portfolio
Here:</strong></font>
</center>
<form enctype="multipart/form-data" name="entry" method="POST" action="<?php
echo $PHP_SELF?>">
&nbsp;
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="14%"><strong>First Name:</strong></td>
<td width="43%"><input name="first" type="text" size="30"
maxlength="45"></td>
<td width="43%"><font size="2" face="Arial, Helvetica,
sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td><strong>Last Name: </strong></td>
<td><input name="last" type="text" size="30" maxlength="45"></td>
<td><font size="2" face="Arial, Helvetica, sans-serif"><strong>*Last name
shall
not be used on the website, but</strong></font></td>
</tr>
<tr>
<td><strong>Age:</strong></td>
<td><input name="age" type="text" size="30" maxlength="3"></td>
<td><font size="2" face="Arial, Helvetica, sans-serif"><strong>for internal
use
only.</strong></font></td>
</tr>
<tr>
<td><strong>Email:</strong></td>
<td><input name="email" type="text"  size="30" maxlength="45"></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td><strong>Location:</strong></td>
<td><input name="location" type="text" id="location" size="30"
maxlength="60"></td>
<td><font size="2" face="Arial, Helvetica, sans-serif"><strong>*Location-
please
do not be specific, but only</strong></font></td>
</tr>
<tr>
<td><strong>Eye Color</strong></td>
<td><input name="eye" type="text" id="eye" size="30" maxlength="45"></td>
<td><font size="2" face="Arial, Helvetica, sans-serif"><strong>state or
region.</strong></font></td>
</tr>
<tr>
<td><strong>Hair Color:</strong></td>
<td><input name="hair" type="text" id="hair" size="30" maxlength="45"></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td valign="top"><strong>Experience:</strong></td>
<td><textarea name="experience" cols="60" rows="10"
id="experience"></textarea></td>
<td valign="top"><font size="2" face="Arial, Helvetica,
sans-serif"><strong>*
Any experience pertaining to your talent aspirations- school plays,
photoshoots,
etc..</strong></font></td>
</tr>
<tr>
<td valign="top"><strong>Aspirations:</strong></td>
<td><textarea name="aspirations" cols="60" rows="10"
id="aspirations"></textarea></td>
<td valign="top"><font size="2" face="Arial, Helvetica,
sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td valign="top"><strong>Media Type:</strong></td>
<td><textarea name="mtype" cols="60" rows="10" id="mtype"></textarea></td>
<td valign="top"><font size="2" face="Arial, Helvetica,
sans-serif"><strong>*Media
type includes specific types of jobs/ offers you are interested in.
</strong></font></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="24%"><div align="right">Upload Picture 1:</div></td>
<td width="33%"><div align="right">
<input type="file" name="picname1" value="Upload">
</div></td>
<td width="43%" rowspan="9">&nbsp;</td>
</tr>
<tr>
<td><div align="right">Upload Picture 2:</div></td>
<td><div align="right">
<input type="file" name="picname2" value="Upload">
</div></td>
</tr>
<tr>
<td><div align="right">Upload Picture 3:</div></td>
<td><div align="right">
<input type="file" name="picname3" value="Upload">
</div></td>
</tr>
<tr>
<td><div align="right">Upload Picture 4:</div></td>
<td><div align="right">
<input type="file" name="picname4" value="Upload">
</div></td>
</tr>
<tr>
<td><div align="right">Upload Picture 5:</div></td>
<td><div align="right">
<input type="file" name="picname5" value="Upload">
</div></td>
</tr>
<tr>
<td><div align="right">Upload Picture 6:</div></td>
<td><div align="right">
<input type="file" name="picname6" value="Upload">
</div></td>
</tr>
<tr>
<td><div align="right">Upload Picture 7:</div></td>
<td><div align="right">
<input type="file" name="picname7" value="Upload">
</div></td>
</tr>
<tr>
<td><div align="right">Upload Picture 8:</div></td>
<td><div align="right">
<input type="file" name="picname8" value="Upload">
</div></td>
</tr>

</table>
<p align="left">
<input name="submit" type="submit" value="Submit">
</p>
</form>
<?
}

?>


</body>
</html>

************************************************

Sorry for the newbie question and the long-winded accompanying info here but
I cannot pinpoint my error.  I hope there is an easily spotted culprit
above.  Thanks again!  -John


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux