0

here is my code for image upload. after upload successfully i want to go my mainpage.php page . i am using iframe to display upload form. how to go mainpage. please anyone help me for this problem .

<?php

include("connect.php");

$_SESSION['MM_Username'] ;
$username=$_SESSION['MM_Username'];

if(isset($_POST['submit']))
{
        //get file attributes

        $name=$_FILES['myfile']['name'];
        $tmp_name=$_FILES['myfile']['tmp_name'];

        if($name)
        {
                //start upload process

                $location="$name";
                move_uploaded_file($tmp_name,$location);
                $query=mysql_query("UPDATE members SET avatar='$location' WHERE username='$username'");
                die();
                
        }
        else
        {
                echo "Please upload a file";
        }       
}

echo "upload image: <br>

<form action='upload.php' method='POST' enctype='multipart/form-data'>

File:<input type='file' name='myfile'><input type='submit' name='submit' Value='Upload'
</form>";

?>
3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by divyakrishnan
1

After your update query redirect your page to main page.
So you have to include this line after your query line (line no : 23):

header("Location: main.php");

If this in not your requirement, Please be more specific.

Votes + Comments
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.