Re: Image / file uploader
| From: | Craig Hoffman | Date: | Fri, 30 Apr 2004 14:40:55 +0000 |
| Subject: | Re: Image / file uploader | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34213@lists.php.net to get a copy of this message | ||
That worked! Han's and everyone else thank you very much. I owe everyone who helped out a beer. ;)
Thanks CH
__________________________________
Craig Hoffman - eClimb Media
v: (847) 644 - 8914
f: (847) 866 - 1946
e: choffman@eclimbmedia.com
w: www.eclimbmedia.com
_________________________________
On Apr 30, 2004, at 9:22 AM, Hans Lellelid wrote:
Errr.... $HTTP_POST_FILES is not superglobal .... (am I wrong?) $_FILES or specify global $HTTP_POST_FILES Hans Craig Hoffman wrote:<? function display_edit_bio($user_id) {if($_POST['postback_bio']) { include "include/dbadmin.php"; //image uploader $uploadpath = 'images/clients/'; $source = $HTTP_POST_FILES['photo']['tmp_name']; $photo_name = $HTTP_POST_FILES['photo']['name']; $dest = ''; if (($source != '') && ($source != '')) { $dest = $uploadpath.$photo_name; if ($dest != '') { if (move_uploaded_file($source, $dest)) { echo ("<p id='message'>Image and Bio has been successfully stored.</p> "); } else { echo ("<p id='message'>Image could not be stored.</p>"); } } } else { echo ("<p id='message'>No new image supplied.</p>"); $photo_name = $oldimage; } //declare varibles $user_id = $_POST["user_id"]; $name = $_POST["name"]; $bio = $_POST["bio"]; $goals = $_POST["goals"]; $fav_race = $_POST["fav_race"]; $fav_train = $_POST["fav_train"]; $photo = $_POST["photo_name"]; $query = "UPDATE users SET bio = '$bio', goals = '$goals', fav_race = '$fav_race', fav_train = '$fav_train', photo_name = '$photo_name' WHERE user_id = '$user_id'"; echo $query; $msg = "<span style='color:red' id='message'>Could not update record</span>"; $result = mysql_query($query, $db) or ($msg); }