hellonoko Posted December 23, 2007 Share Posted December 23, 2007 My below code is generating this parse error: Parse error: syntax error, unexpected ';', expecting '{' in C:\www\idea\imagebox\add_image.php on line 45 Line 45 is: function copy_image( $file_name ); $action = $HTTP_POST_VARS[action]; if ($action == "copy") { function copy_image( $file_name ); } if ($action == "upload") { function upload_image( $imagefile ); } Functions below. Any dieas?: Thanks <?php //upload image function function upload_image($imagefile,$image_to_thumbnail) { ini_set('display_errors', 1); error_reporting(E_ALL); //$submit = $_POST['Submit']; if (empty($_FILES['imagefile'])) { echo "<br><br>"; echo "Please choose a image to upload..."; die; } if(!empty( $HTTP_POST_VARS['imagefile'] )) { //If the Submitbutton was pressed do: if ($_FILES['imagefile']['type'] == "image/jpeg") { $_FILES['imagefile']['name'] = str_replace(" ", "_", $_FILES['imagefile']['name']); copy ($_FILES['imagefile']['tmp_name'], "images/full/".$_FILES['imagefile']['name']) or die ("Could not copy"); echo "<br><br>"; echo "<b>File Uploaded...</b>"; } else { echo "<br><br>"; //echo "Could Not Copy... (".$_FILES['imagefile']['name'].")<br>"; echo "Could Not Copy... <br>"; die; } } echo "<br>"; $image_to_thumbnail = $_FILES['imagefile']['name']; //echo $image_to_thumbnail; include "resize_image.php"; echo "image uploaded"; echo "<br>"; echo "<img src=images/thumbs/t_".$image_to_thumbnail." />"; echo "<br>"; echo "<img src=images/full/".$image_to_thumbnail." />"; } ?> <?php //function to copy image function copy_image($url, $file_name, $image_to_thumbnail) { $url = $HTTP_POST_VARS[url]; $file_name = $HTTP_POST_VARS[filename]; if ($url == "") { echo "You must enter a url. "; echo "<meta http-equiv='REFRESH' content=3;url=add_image.php>"; } if ($file_name == "") { echo "You must name the file. "; echo "<meta http-equiv='REFRESH' content=3;url=add_image.php>"; exit(); } if ($url != "") { copy( $url, "images/full/".$file_name ); $image_to_thumbnail = $file_name; include "resize_image.php"; echo "image coppied"; echo "<br>"; echo "<img src=images/thumbs/t_".$image_to_thumbnail." />"; echo "<br>"; echo "<img src=images/full/".$image_to_thumbnail." />"; } } ?> Link to comment https://forums.phpfreaks.com/topic/82885-solved-wtf-parse-error/ Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 You do not use the function keyword when calling a function. function copy_image( $file_name ); should be... copy_image( $file_name ); Link to comment https://forums.phpfreaks.com/topic/82885-solved-wtf-parse-error/#findComment-421539 Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 Also note that your copy_image function expects three arguments, your only passing it one. This will generate another error. Link to comment https://forums.phpfreaks.com/topic/82885-solved-wtf-parse-error/#findComment-421540 Share on other sites More sharing options...
hellonoko Posted December 23, 2007 Author Share Posted December 23, 2007 Oh yea... *hands head in shame* Thanks! Link to comment https://forums.phpfreaks.com/topic/82885-solved-wtf-parse-error/#findComment-421541 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.