Note : Save this page session.php
Note : Remove "\" from all HTML tag and php start tag
<\?php
session_start();
$sessValue = "";
if(isset($_REQUEST['submit']))
{
$sessValue = $_REQUEST['sessValue'];
if(!isset($_SESSION['sessValue1']))
{
echo $_SESSION['sessValue1']=$sessValue;
}
else
{
echo $_SESSION['sessValue1']=$_SESSION['sessValue1'].$sessValue;
}
}
?>
<\html>
<\body>
<\form name="frm" action="session.php" method="post">
<\input type="text" name="sessValue">
<\input type="submit" name="submit" value="submit">
<\/form>
<\/body>
<\/html>
Tuesday, January 19, 2010
How to upload file in php
Step 1 - Save Bellow code name "upload.php"
Step 2 - Create a folder name upload for file upload
Note : Remove "\" from all HTML tag and php start tag
<\?php
if(isset($_REQUEST['submit']))
{
$tmp_file = $_FILES['upload']['tmp_name'];
$filename = $_FILES['upload']['name'];
if(move_uploaded_file("$tmp_file", "upload/$filename"))
{
echo "File Success Fully Uploaded";
}
else
{
echo "File Upload Failed";
}
}
?>
<\html>
<\body>
<\form name="frm" method="post" action="upload.php" enctype="multipart/form-data">
<\input type="file" name="upload">
<\input type="submit" name="submit" value="Upload">
<\/form>
<\/body>
<\/html>
Step 2 - Create a folder name upload for file upload
Note : Remove "\" from all HTML tag and php start tag
<\?php
if(isset($_REQUEST['submit']))
{
$tmp_file = $_FILES['upload']['tmp_name'];
$filename = $_FILES['upload']['name'];
if(move_uploaded_file("$tmp_file", "upload/$filename"))
{
echo "File Success Fully Uploaded";
}
else
{
echo "File Upload Failed";
}
}
?>
<\html>
<\body>
<\form name="frm" method="post" action="upload.php" enctype="multipart/form-data">
<\input type="file" name="upload">
<\input type="submit" name="submit" value="Upload">
<\/form>
<\/body>
<\/html>
Subscribe to:
Posts (Atom)