ded Posted February 10, 2009 Share Posted February 10, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/144637-solved-failed-to-open-stream-error-on-uploads/ Share on other sites More sharing options...
premiso Posted February 10, 2009 Share Posted February 10, 2009 You are trying to move a file to your website url, you need to use the actual server path like /home1/website/flyers/ instead of http://etcetc Quote Link to comment https://forums.phpfreaks.com/topic/144637-solved-failed-to-open-stream-error-on-uploads/#findComment-758976 Share on other sites More sharing options...
ded Posted February 10, 2009 Author Share Posted February 10, 2009 Wow.....awefully dumb of me....thanks. DED Quote Link to comment https://forums.phpfreaks.com/topic/144637-solved-failed-to-open-stream-error-on-uploads/#findComment-758979 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.