Jump to content

[SOLVED] Failed to open stream error on uploads


ded

Recommended Posts

When trying to upload a file, I receive the following:

Warning:  move_uploaded_file( http://www.website.com/flyers/NYOpen09.pdf) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home1/website/public_html/admin/cpanel/calendar/postedit.php on line 27

 

Warning:  move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpc4WB72' to 'http://www.website.com/flyers/NYOpen09.pdf' in /home1/website/public_html/admin/cpanel/calendar/postedit.php on line 27

 

Possible file upload attack!

 

My host does not see a problem on the permissions side.

 

Here is the POST.php code

<?php session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
</head>
<body>
<?php $sdate= $_POST['syear'] . $_POST['smonth']. $_POST['sday'];
$edate= $_POST['eyear'] . $_POST['emonth']. $_POST['eday'];
$tournament = $_POST['tournament'] ;
$purse = $_POST['purse'] ;
$city = $_POST['city'] ;
$state = $_POST['state'] ;
$region = $_POST['region'] ;
$association = $_POST['association'] ;
$contact1 = $_POST['contact1'] ;
$phone1 = $_POST['phone1'] ;
$email1 = $_POST['email1'] ;
$contact2 = $_POST['contact2'] ;
$phone2 = $_POST['phone2'] ;
$email2 = $_POST['email2'] ;
$website = $_POST['website'] ;
$comments = $_POST['comments'] ;
if($_FILES['filename']['error'] != 4) {
$uploaddir = 'http://www.website.com/flyers/';
$uploadfile = $uploaddir . basename($_FILES['filename']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
print "</pre>";
}
$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("website_Tournament");
$insert = "INSERT INTO `2009tournaments` (`sdate` , `edate` , `tournament` , `purse` , `city` , `state` , `region` , `association` ,`contact1` , `phone1` , `email1` , `contact2` , `phone2` , `email2` , `website` , `comments` , `filename` )
VALUES ('$sdate', '$edate', '$tournament', '$purse', '$city', '$state', '$region', '$association', '$contact1', '$phone1', '$email1', '$contact2', '$phone2', '$email2', '$website', '$comments', '$uploadfile')";
$results = mysql_query($insert) or die(mysql_error());
echo "<br>$tournament loaded to database";
?>
</body></html>

 

Any help would be great,

DED

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.