Code that use to work and no longer does!?
Posted: Fri Apr 02, 2004 12:36 pm
OK guys, first new to this forum so a hello to all. I am not by any means and experienced php coder although I am a programmer of many years.
I friend has a site that was already up and running until she had to move it to another server. I am assuming an upgrade on the version of php has broken this script, I have tried a multitude of changes with no success so have decided the best solution is to get help from the pros.
There are two scripts one calls the other to upload informtion to mysql and move a image from the personal machine to a folder on the site. Folder on the site is set to permissions 755. All the details about a product go into the mysql along with the path of the picture, this in turn is used to layout a page. The error message I get looks like this:
copy C:\\Documents and Settings\\tsikora\\My Documents\\sites\\flyingstarstables\\data\\images\ \saddles\\cntycmp_b.JPG to
Warning: copy(C:\\Documents and Settings\\tsikora\\My Documents\\sites\\flyingstarstables\\data\\images\ \saddles\\cntycmp_b.JPG): failed to open stream: No such file or directory in /home/kbenson/public_html/saddleadded.php on line 32
The two scripts, first the form:
?>
<FORM ACTION="saddleadded.php" METHOD=POST>
<INPUT TYPE="radio" NAME="type" VALUE=1>Jumping<INPUT TYPE="radio" NAME="type" VALUE=2>Dressage<BR>
Brand: <INPUT TYPE="text" NAME="brand"><BR>
Treesize: <INPUT TYPE="text" NAME="treesize"><BR>
Seatsize: <INPUT TYPE="text" NAME="seatsize"><BR>
Color: <INPUT TYPE="text" NAME="color"><BR>
Description:<BR>
<TEXTAREA NAME="description" ROWS=4 COLS=60></text><BR>
Price: <INPUT TYPE="text" Name="price"><BR>
Thumbnail: <INPUT TYPE="file" name="thumbnail"><BR>
Full-size Picture: <INPUT TYPE="file" name="bigpic"><BR>
<INPUT TYPE="submit" VALUE="Add Saddle">
</FORM>
<?
include("footer.php");
//mysql_close($link);
?>
then the part of the script receiving the error message
<?
include ("header.php");
$Host = 'localhost';
$User = 'user';
$Password = 'password';
$DBName = 'dbname';
$Link = mysql_connect($Host, $User, $Password) or die ('I cannot connect to the database because:' .mysql_error());
if ($bigpic) {
print("copy $bigpic to $bigpic_name");
if(copy($bigpic, "images/saddles/tmp.jpg")) {
print("Big picture successfully uploaded.<P>\n");
}else{
print("Sorry, try again.");
}
}
...there is more but it's all working properly as the mysql database is updated
It seems to me it's trying to find the file to upload on the site itself and I'm not sure why or how to fix it.
Thanks
Terri

I friend has a site that was already up and running until she had to move it to another server. I am assuming an upgrade on the version of php has broken this script, I have tried a multitude of changes with no success so have decided the best solution is to get help from the pros.
There are two scripts one calls the other to upload informtion to mysql and move a image from the personal machine to a folder on the site. Folder on the site is set to permissions 755. All the details about a product go into the mysql along with the path of the picture, this in turn is used to layout a page. The error message I get looks like this:
copy C:\\Documents and Settings\\tsikora\\My Documents\\sites\\flyingstarstables\\data\\images\ \saddles\\cntycmp_b.JPG to
Warning: copy(C:\\Documents and Settings\\tsikora\\My Documents\\sites\\flyingstarstables\\data\\images\ \saddles\\cntycmp_b.JPG): failed to open stream: No such file or directory in /home/kbenson/public_html/saddleadded.php on line 32
The two scripts, first the form:
?>
<FORM ACTION="saddleadded.php" METHOD=POST>
<INPUT TYPE="radio" NAME="type" VALUE=1>Jumping<INPUT TYPE="radio" NAME="type" VALUE=2>Dressage<BR>
Brand: <INPUT TYPE="text" NAME="brand"><BR>
Treesize: <INPUT TYPE="text" NAME="treesize"><BR>
Seatsize: <INPUT TYPE="text" NAME="seatsize"><BR>
Color: <INPUT TYPE="text" NAME="color"><BR>
Description:<BR>
<TEXTAREA NAME="description" ROWS=4 COLS=60></text><BR>
Price: <INPUT TYPE="text" Name="price"><BR>
Thumbnail: <INPUT TYPE="file" name="thumbnail"><BR>
Full-size Picture: <INPUT TYPE="file" name="bigpic"><BR>
<INPUT TYPE="submit" VALUE="Add Saddle">
</FORM>
<?
include("footer.php");
//mysql_close($link);
?>
then the part of the script receiving the error message
<?
include ("header.php");
$Host = 'localhost';
$User = 'user';
$Password = 'password';
$DBName = 'dbname';
$Link = mysql_connect($Host, $User, $Password) or die ('I cannot connect to the database because:' .mysql_error());
if ($bigpic) {
print("copy $bigpic to $bigpic_name");
if(copy($bigpic, "images/saddles/tmp.jpg")) {
print("Big picture successfully uploaded.<P>\n");
}else{
print("Sorry, try again.");
}
}
...there is more but it's all working properly as the mysql database is updated
It seems to me it's trying to find the file to upload on the site itself and I'm not sure why or how to fix it.
Thanks
Terri