I think you want single quotes around PHP_SELF.

"$_SERVER['PHP_SELF']"

> I have a script where it uploads a image to directory.   I have used
> the script several times and it works when I send the form to another
> page.  The problem is I have changed the form to submit to itself and I
> can't seem to get it to work.
>
> echo (" <form method='post' action='$_SERVER[PHP_SELF]'
> encType='multipart/form-data'>");
>
> The thing is all my other fields update except for the image.  Further,
> the image does not even show up if I echo the query out.
>
> UPDATE users SET bio = 'Bio - Test', goals = 'Goals - Test', fav_race =
> 'Fav Races - test', fav_train = 'Traing -test', photo_name = '' WHERE
> user_id = '1'
> Here is the code of the image uploader and my query, perhaps someone
> could take a look let me know what I'm missing.
> Thanks - CH
>
> <input type='file' name='photo'>
>
> 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);
>
>       }
>
>
> __________________________________
> Craig Hoffman - eClimb Media
>
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimbmedia.com
> _________________________________
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

Reply via email to