devinemmke, I used that code, but it doesn't seem to be uploading the photo now to the path. Let me note though that it's updating my query to the Y value below, but not executing the copy portion evidently.
I changed the portion of your script that was:
<?
$path_parts = pathinfo($_FILES['userfile']['name']);
if (isset ($path_parts['extension'])) {$ext = $path_parts['extension'];} else {$ext = '';}
move_uploaded_file($_FILES['file']['tmp_name'], $path . $_SESSION['username'] . '.' . $ext);
and changed it back to
$path_parts = pathinfo($_FILES['userfile']['name']);
$seperator = ".";
if (isset ($path_parts['extension'])) {$ext = $path_parts['extension'];} else {$ext = '';}
copy($_FILES['userfile']['tmp_name'], $path . $_SESSION['username'] . $seperator . $ext);
?>
Although either way I don't see an impact on the refreshing issue. I still need to refesh my browser to see the different image. Logically I understand why it's doing this, ..because every image that I upload overwrites one another because I'm using the same name. Is there any code that I can attach to a photo that would allow me to specifically target that image to refresh?
If I go to Internet Options/General/Settings I can select 'Check for newer versions of stored pages Every visit to the page' and this eliminates the problem however most people have it set to automatically. If a store header information at the top of this particular page with a no cache method, would the upload results refresh that way?
<?
if (isset($_POST['submit']))
{
$path = "c:apachehtdocsmysiteimagesbios";
$max_size = 50000;
$is_uploaded_file = true;
$size = true;
$type = true;
if (!is_uploaded_file($_FILES['userfile']['tmp_name']
)) {$is_uploaded_file = FALSE;}
if ($_FILES['userfile']['size'] > $max_size)
{
$size = FALSE;
$message[] = 'The file is too big. You must keep image size under 50kb.';
}
if (($_FILES['userfile']['type'] != 'image/pjpeg') && ($_FILES['userfile']['type'] != 'image/jpeg'))
{
$type = FALSE;
$message[] = 'Sorry, only .jpg formats allowed.';
}
if (!$is_uploaded_file || !$size || !$type)
{
$message[] = 'Upload has failed.';
}
else
{
$path_parts = pathinfo($_FILES['userfile']['name']);
if (isset ($path_parts['extension'])) {$ext = $path_parts['extension'];} else {$ext = '';}
move_uploaded_file($_FILES['file']['tmp_name'], $path . $_SESSION['username'] . '.' . $ext);
$db = @mysql_connect('localhost','','');
mysql_select_db('journals');
$query = "UPDATE users SET photo='Y' WHERE username = '" . $_SESSION['username'] . "'";
mysql_query($query);
$message[] = 'Upload sucessful!';
$filesize = $_FILES['userfile']['size'] * .001;
$message[] = '(File Size: ' . $filesize . ' KB)<br>';
}
}
?>
<FORM ENCTYPE="multipart/form-data" ACTION="<? echo "$PHP_SELF?page=manage&action=profile" ?>" METHOD="POST">
The file: <INPUT TYPE="file" NAME="userfile">
<INPUT NAME="submit" TYPE="submit" VALUE="Upload">