$profile_status_pic = $profile_data['userPic']; $profile_fullname = $profile_first_name . " " . $profile_last_name; } $query = "SELECT user_id, albumId, albumname \n\t\t\t\t\tFROM photoalbum \n\t\t\t\t\tWHERE user_id = {$profileid}\n\t\t\t\t\tAND albumId={$albumid}"; $result_set = mysql_query($query, $tbconnection); while ($album_data = mysql_fetch_array($result_set)) { $album_name = $album_data['albumname']; } if (isset($_POST['submit'])) { //$_FILES[] upload script $image_fieldname = "file_upload"; $tmp_file = $_FILES[$image_fieldname]['tmp_name']; $target_file = time() . "-" . basename($_FILES[$image_fieldname]['name']); $upload_dir = "assets/images/uploads/albums/albumid{$albumid}"; $file_upload = new FileUpload($tmp_file, $target_file, $upload_dir, $image_fieldname); $message = $file_upload->move_file(); $photofilename = $target_file; $photodesc = trim(mysql_real_escape_string($_POST['desc'])); $query = "INSERT INTO photos (album_id, user_id, photoFname, description) VALUES ({$albumid},{$profileid},'{$photofilename}','{$photodesc}')"; $result_set = mysql_query($query, $tbconnection); if ($result_set) { //redirect to relevant photoalbum.php file*/ redirect_to("photoalbum.php?profileid={$profileid}&albumid={$albumid}"); } else { $sql_error = "Did nto update database" . mysql_error(); } } ?> <!DOCTYPE html> <head>