...

View Full Version : help needed in download attachment



jeganathan
11-23-2010, 10:32 AM
Here i update my query. My problem is i want to open my attachments directly in HTML output.

complete.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My First Project in PHP</title>
</head>

<body bgcolor=tan>
<h1><font color="firebrick">PHP MySQL </font></h1>

<form action="open.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="box" value="100000">
<table width="500" border="1">
<tr><td><b><label for='Uname'>Name :</b></label></td> <td><input type="text" name="Uname" size="20" /></td></tr>
<tr><td><b><label for='mail'>Email :</b></label></td><td><input type="text" name="mail" size="20" /></td></tr>
<tr><td><b> <label for='Updated_file'>Attachements:</b></label></td> <td> <input type="file" name="Updated_file" id="userfile" /></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Submit" name="submit" onClick="return validate();"> <input type="reset" value="Reset" name="reset"> </td></tr>
</table>
</form>
</body>
</html>


open.php

<?php
$con = mysql_connect("localhost","root");
mysql_select_db("connect_db", $con);

$Uname = $_POST['Uname'];
$mail = $_POST['mail'];
error_reporting(0);
$Updated_file = $_POST['Updated_file'];
$target_path = $target_path . basename( $_FILES['Updated_file']['name']);
move_uploaded_file($_FILES['Updated_file']['tmp_name'], $target_path);
$eBanner = basename( $_FILES['Updated_file']['name']);

$query = "INSERT INTO details (Name, Email, Attachements) VALUES ('".$Uname."', '".$mail."', '".$Updated_file."')";
mysql_query($query, $con) or die(mysql_error());

$result = mysql_query("SELECT * FROM details");
while($row = mysql_fetch_array($result))
{

echo "<font color='red'>Name :</font> ".$row['Name'].",<br />";

echo "<font color='blue'>Email :</font>".$row['Email'].",<br />";

echo "<font color='green'>Attachements :</font>".'"<a href="http://localhost/" > Download "Updated_file"</a>"'.".<br />";

echo "<br />";

}

mysql_close($con);
?>

abduraooft
11-23-2010, 03:38 PM
My problem is i want to open my attachments directly in HTML output Sorry, that's not clear. Did you mean you need to open the file in the browser rather than asking a download prompt?

jeganathan
11-24-2010, 05:09 AM
S. I need to open the file in the browser

fresnelllords
11-25-2010, 11:11 AM
Subscribing !! Information needed on this topic..

jeganathan
11-25-2010, 01:21 PM
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

welcome.php

Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.



Here I want to directly edit the fname and age in output.

jeganathan
11-25-2010, 01:22 PM
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

welcome.php

Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.



Here I want to directly edit the fname and age in output. What is the code.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum