== "image/jpg" || $type == "image/gif" || $type == "image/pjpeg" || $type == "image/jpeg"){ // is this a valid image? $time_tmp = time(); $time_tmp = substr("$time_tmp", -4); $filename = $time_tmp._.$name; // just in case someone uploads matched filenames. $savepath = "/home/*********/*******/php/".$filename; // change the path here. make sure the directory it is going to can be written to by the web user. $moved = move_uploaded_file($file, $savepath); // place the file on the server's filesystem $path = $filename; } else { // wrong file type $path = "Sorry, but the file type of this file is not recognised. Please check and try again.<p>"; } } else { // upload failed. $path ="Sorry, but the upload failed. Please try again in a short while.<p>"; } return $path; } // uploaded file info-zone - prepare variables to be passed to the upload function $name = $HTTP_POST_FILES['picture']['name']; // orginal name $type = $HTTP_POST_FILES['picture']['type']; // get MIME type of file $path = fileUpload($name,$type,$picture); // yer actual upload function call
// I'd recommend you check the value of $path here - if it contains a text string starting with "Sorry" then something has failed. // and off to the database it goes. $sql = "INSERT INTO $table_name (id, name, email, picture_name) VALUES ('$id', '$name', '$email', '$path') "; $result = mysql_query($sql, $connection) or die ("couldn't execute query"); in article 005301c1b576$31479df0$0a00000a@AERIS, Girish Nath at [EMAIL PROTECTED] wrote on 2/14/2002 4:39 PM: > Hi > > I got this error : > > Warning: Unexpected character in input: ' in > /home/altdesign/public_html/php/new admin/do_addauthor.php on line 14 > > Can you post the section around Line 14 from do_addauthor.php so we can take > a look at it ? > > Regards > > > Girish > -- > www.girishnath.co.uk > > > ----- Original Message ----- > From: "Will Hives" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, February 14, 2002 4:34 PM > Subject: [PHP] any ideas : Unexpected character > > > > I have put together this script with the help of some of you kind members > here. It seems to do what I set out for it to do, but when it finished the > upload it comes up with the following error: > > Unexpected character > > try for yourself: http://www.alt-design.net/php/new%20admin/add.php > > I would be very grateful for any ideas. > > Cheers > Will > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php