Re: Image / file uploader

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);


}


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux