Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help needed in download attachment

    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);
    ?>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Browser

    S. I need to open the file in the browser

  • #4
    New to the CF scene
    Join Date
    Aug 2010
    Location
    Universe
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Subscribing !! Information needed on this topic..

  • #5
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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.

  • #6
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •