Hi,
Thank for your reply. Please find the code below I am using. Please suggest me a solution.
Hi,
Thank you very much for your replies. Please find the code.
[syntax=php]
<?php
if(isset($POST["action"]) == "Upload Image")
{
if ((($FILES["file"]["type"] == "image/gif")
|| ($FILES["file"]["type"] == "image/jpeg")
|| ($FILES["file"]["type"] == "image/pjpeg"))
&& ($FILES["file"]["size"] < 20000))
{
if ($FILES["file"]["error"] > 0)
{
echo "Return Code: " . $FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $FILES["file"]["name"] . "<br />";
echo "Type: " . $FILES["file"]["type"] . "<br />";
echo "Size: " . ($FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
}
?>
<script type="text/javascript">
function displaymessage()
{
//Some validation code
var flag=0;
if(filepath!="")
{
alert(<?php echo("hiii") ?>);
}
if(str=="")
{
alert("Please enter the Company name.");
document.myform.txtCompanyname.focus();
flag=1;
return false;
}
...........................
.........................
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
alert(xmlhttp.responseText);
}
}
xmlhttp.open("POST","<?php bloginfo('template_url'); ?>/Vendorinformation.php?",true);
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send(Datatosend);
<?PHP echo("string"); ?>
location.href="http://www.thillaimadhunayanar.com/?page_id=29";
}
</script>
<FORM name="frmvendor" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table>
<tr valign="top">
<td><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="ראשי <?php the_title(); ?>">Vendor-Join us</a></h2>
<tr><td class="label2">Logo</span></td>
<td class="label1"><input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input name="userfile" type="file" id="userfile"> </td></tr>
......................................................................................
......................................................................................
<tr>
<td width="246">
<p><input type="file" name="image_file" size="20"></p>
<p><input type="submit" value="Upload Image" name="action"></p></td>
</tr>
<tr><td colspan="2">
<?php
echo '<input type="button" name="submit" id="submit" onclick="displaymessage()">';
?>
</td></tr>
</tbody>
</table>[/syntax]
Thanks,
Regards,
Viji
Regards,
Viji