dark22horse Posted August 5, 2007 Share Posted August 5, 2007 Hi guys, I have run into a bit of a problem, on my sql server a script runs and updates everything, but when I put it live, it hasnt <html> <head> <title>Uploaded</title> <link href="images/CliftonMotors.css" rel="stylesheet" type="text/css"> </head> <body style="margin:0;"> <TABLE WIDTH=775 height="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR> <TD height="89" COLSPAN=2> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="374"><img src="images/toplogo2.gif" width=374 height=89 alt=""></td> <td> <TABLE width="401" BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR> <TD COLSPAN=11> <IMG SRC="images/jd_b038_02.gif" WIDTH=401 HEIGHT=40 ALT=""></TD> </TR> <TR> <TD><a href="index.php"><IMG SRC="images/home.gif" ALT="" WIDTH=51 HEIGHT=49 border="0"></a></TD> <TD><IMG SRC="images/navspacer2.gif" WIDTH=1 HEIGHT=49 ALT=""></TD> <TD><a href="Cars.php"><IMG SRC="images/CliftonMotorSales.gif" ALT="" WIDTH=121 HEIGHT=49 border="0"></a></TD> <TD><IMG SRC="images/navspacer2.gif" WIDTH=1 HEIGHT=49 ALT=""></TD> <TD><a href="Repairs.html"><IMG SRC="images/CliftonMotors.gif" ALT="" WIDTH=92 HEIGHT=49 border="0"></a></TD> <TD><IMG SRC="images/navspacer2.gif" WIDTH=1 HEIGHT=49 ALT=""></TD> <TD><a href="Location.html"><IMG SRC="images/location.gif" ALT="" WIDTH=66 HEIGHT=49 border="0"></a></TD> <TD><IMG SRC="images/navspacer2.gif" WIDTH=1 HEIGHT=49 ALT=""></TD> <TD><a href="Feedback.html"><IMG SRC="images/feedback.gif" ALT="" WIDTH=66 HEIGHT=49 border="0"></a></TD> <TD><IMG SRC="images/navspacer2.gif" WIDTH=1 HEIGHT=49 ALT=""></TD> </TR> </TABLE></td> </tr> </table></TD> </TR> <TR> <TD valign="top" background="images/pixi_1.gif"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><TABLE width="553" BORDER=0 CELLPADDING=0 CELLSPACING=0> </TABLE></td> </tr> <tr> <td height="18" background="images/pixi_grey.gif" style="padding-left:40;padding-top:5;padding-right:35;"><h1> Updating Stock</h1></td> </tr> <tr> <td style="padding-left:40;padding-top:25; padding-right:35;padding-bottom:25;"> <? require_once("mysql_config.php"); $target_path = $target_path . basename( $_FILES['photo']['name']); $_FILES['photo']['tmp_name']; $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['photo']['name']); $id = $_POST['id']; $price = $_POST['price']; $key_description = $_POST['key_description']; $description = $_POST['description']; $photo = $_FILES['photo']['name']; $photo1 = $_FILES['photo1']['name']; $photo2 = $_FILES['photo2']['name']; $photo3 = $_FILES['photo3']['name']; $car_of_the_week = $_POST['car_of_the_week']; $status1 = $_POST['status1']; $id = mysql_real_escape_string($id); $price = mysql_real_escape_string($price); $description = mysql_real_escape_string($description); $car_of_the_week = mysql_real_escape_string($car_of_the_week); $status1 = mysql_real_escape_string($status1); [color=red]if(move_uploaded_file($_FILES['photo']['tmp_name'], $target_path)) { [/color] $sql_string = "UPDATE car SET price='$price', key_description='$key_description', description='$description', photo='$photo', photo1='$photo1', photo2='$photo2', photo3='$photo3', car_of_the_week='$car_of_the_week', status1='$status1'"." WHERE id='$id'"; mysql_query($sql_string) OR die(mysql_error()); $ok = mysql_query($sql_string); if($ok){ echo "<h2>all is good, upload another</h2>"; } else { echo "<h2>check the string".$sql_string."</h2>"; } } else{ $sql_string = "UPDATE car SET price='$price', key_description='$key_description', description='$description', car_of_the_week='$car_of_the_week', status1='$status1'"." WHERE id='$id'"; $ok = mysql_query($sql_string); if($ok){ echo "<h2>The car has been updated succesfully</h2>"; } else { echo "<h2>error updating car</h2>"; } } ?> <a href="update.php"> Click here to update another car </a> </tr> </table></TD> </TR> <TR> <TD background="images/pixi_2.gif" height="37" COLSPAN=2 style="padding-left:40;">© Copyright 2007. Clifton Motors. </TD> </TR> <TR> <TD height="7" COLSPAN=2 background="images/pixi_grey.gif"><IMG SRC="images/spacer.gif" WIDTH=775 HEIGHT=7 ALT=""></TD> </TR> </TABLE> </BODY> </html> I have highlighted the error Warning: move_uploaded_file(uploads/clio2.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/vhosts/clifton-motors.co.uk/httpdocs/uploader3.php on line 78 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php1JHaqH' to 'uploads/clio2.jpg' in /var/www/vhosts/clifton-motors.co.uk/httpdocs/uploader3.php on line 78 the errors im getting Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/ Share on other sites More sharing options...
Fadion Posted August 5, 2007 Share Posted August 5, 2007 the server is denying u to upload files as probably those directories dont have write permissions. Try to CHMOD 777 or 664 those directories. Hope it helped. Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/#findComment-315876 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 You need to give directory you're moving files to write permissions. If it's just an image directory you can set permissions to 777 if it's something you need a little more secure you'll want to lock it down a bit. Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/#findComment-315878 Share on other sites More sharing options...
dark22horse Posted August 5, 2007 Author Share Posted August 5, 2007 where would I do this on phpadmin? or another one? Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/#findComment-315882 Share on other sites More sharing options...
lightningstrike Posted August 5, 2007 Share Posted August 5, 2007 Obviously not. You need to CHMOD through cpanel, ftp, shell. I assume ftp is probably what your looking for. Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/#findComment-315883 Share on other sites More sharing options...
dark22horse Posted August 5, 2007 Author Share Posted August 5, 2007 how would i change the chmod in ftp then? that is how i am upping the site? Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/#findComment-315892 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 If your site has a cpanel there should be a file/folder management section that lets you set file/folder permissions. chmod 777 says let everyone do everything to files in here. So if you have checkboxes for read/write/execute just check them all and it'll do 777 permissions for you. Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/#findComment-315894 Share on other sites More sharing options...
dark22horse Posted August 5, 2007 Author Share Posted August 5, 2007 cheers guys, it had plesk or something, found it on there! I guess after hours working on it, the simple things are always complicated! Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/#findComment-315896 Share on other sites More sharing options...
dbo Posted August 5, 2007 Share Posted August 5, 2007 Most of the time it's the simple stuff. Quote Link to comment https://forums.phpfreaks.com/topic/63375-solved-php-help/#findComment-315900 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.