ted_chou12 Posted January 7, 2007 Share Posted January 7, 2007 this is the error:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www/....../photoupload.php on line 78but I dont understand what it means, can anyone suggest me what the problem might be? Quote Link to comment Share on other sites More sharing options...
papaface Posted January 7, 2007 Share Posted January 7, 2007 Show us the code...(and make sure you tell us where line 78 is)Also make sure you use [*code]to put your code in[*/code] Quote Link to comment Share on other sites More sharing options...
mkosmosports Posted January 7, 2007 Share Posted January 7, 2007 Can you send that entire line of code? Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 7, 2007 Share Posted January 7, 2007 my guess is he is using a $_POST, $_GET, or $_SESSION var, or some type of var that requires ['name'] and is trying to echo it..but alas we need to see the code Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted January 7, 2007 Author Share Posted January 7, 2007 code here:[code] <?php if(isset($_POST['submit'])){ //checks file extension $filename = $_FILES['uploadedfile']['name']; $ext = explode(".", $filename); if ($ext[1] != "jpg" && $ext[1] != "gif" && $ext[1] != "png" && $ext[1] !="jpeg") {echo "<p><b>The file you uploaded does not have an image extension!</b></p>";} else { // Where the file is going to be placed $target_path = "images/photo/"; $datetime = date("Y-m-d H:i:s"); $counter = ("images/photo/photonumber.txt"); $hits = file($counter); $hits[0] ++; $fp = fopen($counter , "w"); fputs($fp , "$hits[0]"); fclose($fp); $number = file_get_contents("images/photo/photonumber.txt"); /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename($_FILES['uploadedfile']['name']); $_FILES['uploadedfile']['tmp_name']; $target_path = "images/photo/"; $target_path = $target_path . basename("photo".$number.".jpg"); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {require("../mysqlconnection.php"); $insert = mysql_query("INSERT INTO photo(username, photonumber, photoname, photodate) VALUES('$username', '$number', '$_FILES]['uploadedfile'['name']', '$datetime') ");//78 else {echo"<p><b>There was an error uploading the image, please try again!</b></p>";} if($insert === false) {echo"<p><b>There was an error uploading the image, please try again!</b></p>";} else {header("location: confirm.php?confirm=photoedit_upload");}}}}?> <form enctype="multipart/form-data" action="" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" name=submit value="Upload File" /> </form>[/code] Quote Link to comment Share on other sites More sharing options...
papaface Posted January 7, 2007 Share Posted January 7, 2007 Where is line 78? Quote Link to comment Share on other sites More sharing options...
simcoweb Posted January 7, 2007 Share Posted January 7, 2007 Umm..that's not all the code. Only 47 lines there. :) Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 7, 2007 Share Posted January 7, 2007 first of all:those && should be || because it cannot have all of those extenstions at once[code]if ($ext[1] != "jpg" && $ext[1] != "gif" && $ext[1] != "png" && $ext[1] !="jpeg") [/code]next, get rid of the " around your var in this line:[code]fputs($fp , "$hits[0]");[/code]now see what errors u get Quote Link to comment 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.