wasper-rocker Posted July 6, 2006 Share Posted July 6, 2006 I am running this script to get a file uploaded to a directory on my server but it just comes up with this error.[code]<?php $target = "www.wasper-rocker.co.uk/Protected/uploaded/"; $target = $target . basename( $_FILES['uploaded']['name']);if ($uploaded_size > 250000){echo "Your file is too large.<br>"; $ok=0;} if (!($uploaded_type=="image/gif")) {if (!($uploaded_type=="image/jpeg")) {echo "You may only upload Image files.<br>";$ok=0;} }if ($ok==0) { Echo "Sorry your file was not uploaded"; } if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";$con = mysql_connect("localhost","i04wasp_duncan","WASP5rock");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("i04wasp_", $con);$sql="INSERT INTO account(picname)VALUES('$_POST[nickname]$_FILES['uploadedfile']['name'])} else {echo "Sorry, there was a problem uploading your file.";}?> [/code]Error: "Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/i04wasp/public_html/uploaded.php on line 42" Quote Link to comment https://forums.phpfreaks.com/topic/13818-what-is-the-problem-here/ Share on other sites More sharing options...
hackerkts Posted July 6, 2006 Share Posted July 6, 2006 I have modify abit of your code,[code]<?php$target = "www.wasper-rocker.co.uk/Protected/uploaded/";$target = $target . basename( $_FILES['uploaded']['name']);if ($uploaded_size > 250000){echo "Your file is too large.<br>";$ok=0;}if (!($uploaded_type=="image/gif")) {if (!($uploaded_type=="image/jpeg")) {echo "You may only upload Image files.<br>";$ok=0;}}if ($ok==0){Echo "Sorry your file was not uploaded";}if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";}$con = mysql_connect("localhost","i04wasp_duncan","WASP5rock") or die('Could not connect: ' . mysql_error());mysql_select_db("i04wasp_", $con) or die('Sorry, there was a problem connecting to database.');mysql_query("INSERT INTO `account` VALUES ('".$_POST[nickname]."', '".$_FILES['uploadedfile']['name']."')") or die ('Sorry, there was a problem uploading your file.');?>[/code]You need to modify to fit your code, because I'm not sure your database table structure. Quote Link to comment https://forums.phpfreaks.com/topic/13818-what-is-the-problem-here/#findComment-53725 Share on other sites More sharing options...
wasper-rocker Posted July 6, 2006 Author Share Posted July 6, 2006 Now This error comes up: "Sorry your file was not uploadedWarning: move_uploaded_file(www.wasper-rocker.co.uk/Protected/uploaded/henry-head.gif): failed to open stream: No such file or directory in /home/i04wasp/public_html/uploaded.php on line 27Warning: move_uploaded_file(): Unable to move '/tmp/php8u813W' to 'www.wasper-rocker.co.uk/Protected/uploaded/henry-head.gif' in /home/i04wasp/public_html/uploaded.php on line 27Sorry, there was a problem uploading your file." Even though the file does exist. Also i can only upload .gif files Quote Link to comment https://forums.phpfreaks.com/topic/13818-what-is-the-problem-here/#findComment-53934 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.