Upload images to a MySQL database (PHP)?

Ok so i don't get any error but is not doing anything to my database, any suggestions?
<body>
<form action="image.php" method="POST" enctype="multipart/form-data">
File:
    <input type="file" name="image" />
    <input type="submit"  value="Upload"/>
</form>
<?php       
//Conect to database
$mydatabase = mysql_pconnect($hostname_mydatabase, $username_mydatabase, $password_mydatabase) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db("database")or die (mysql_error());
//file properties
$file = $_FILES['image']['tmp_name'];
if (!isset($file))
          echo"PLease select a file";
else
$image=addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name=addslashes($_FILES['image']['name']);
$image_size=getimagesize($_FILES['image']['tmp_name']);
if($image_size==FALSE)
          echo "That's not an image.";
else
          if ($insert = mysql_query("INSERT INTO table VALUES ('$image_name', '$image')"))
          echo "Problem uploading image.";
          else
?>
</body>

Why do you want the binary value of the image?
Just save the image name as you are and then move the uploaded file to the proper folder on your server.
http://php.net/manual/en/function.move-uploaded-file.php

Similar Messages

  • Save an Image in a MySQL database

    I am trying to save an image in a MySQL database. This is what I have done so far; I have created a table with one of the variables called
    photo  blob, this is what you use to save an image right?
    When I write the image to the database after getting connected to it is where I am stuck, so far I can save Ints, Strings and Enum s values but I do not know how to convert my image into a Blob and save the blob. I have been doing some light reading and I am guessing I have to convert the image into a Stream of some sort. What type of stream I do not know. This is the java command I have to save the Blob but do not know what to use as the variable for the Blob.
    prst.setBlob(5,  "??????");As you can tell by the ????? marks, I do not know how to convert my image into the proper data type(whatever the data type is?) to save the contents into the database.
    If somebody has the exact copy of the all the java coded steps that is needed to save an image as a Blob into a prepared database, that would be extremelu helpful to me.
    Thank-you.

    The answer has to be quite simple. If you do not have
    the answer please do not reply.Unfortunately it's not simple. This is one of my betes noire about the java libaries. The Blob stuff has gaping holes in it. There's no method, anywhere, to create a new Blob or Clob (also the design of the Blob and Clob interfaces tends to miss the point).
    The ways arround this, there being no legitimate approach, vary with the database provider.
    If the program an the server are running on the same machine (or files can be shared through NFS or the like) you can try the "LOAD_FILE" function.
    With some databases I believe setBinaryStream instead of setBlob works, but I'm not sure the mySql driver is that smart.

  • Uploading images for a mySQL / PHP database

    Hopefully this can be done - I'm working on a site that uses
    a simple mySQL database, where the records include an image.
    I have the form to add records, including the field
    containing the file name - but is it also possible to upload the
    actual file using the same form to their folder, or does that need
    to be done separately using FTP software?
    The idea is for my client to be able to as easily as possible
    add / delete / edit records himself, so clearly getting the actual
    images uploaded at the same point he adds records to the database
    would be great if that's possible.
    Cheers,
    Iain

    The PHP.NET site really covers it in considerable detail.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "David Powers" <[email protected]> wrote in message
    news:ejo4qf$ee3$[email protected]..
    > Iain71 wrote:
    >> Cheers for that - not sure exactly what I need to do
    tho'
    >
    > I'm sure there are plenty of online tutorials if you
    Google for them. I
    > also cover file uploads in my new book, PHP Solutions.
    It's not
    > particularly difficult, but there are quite a few steps,
    and you need to
    > be aware of security considerations.
    >
    > --
    > David Powers
    > Adobe Community Expert
    > Author, "Foundation PHP for Dreamweaver 8" (friends of
    ED)
    >
    http://foundationphp.com/

  • Storing Uploaded Image Path into Mysql

    Hi I am developing a cms and am using the code David gives in his book PHP Solutions,  everything works fine but I can't work out how to extract the uploaded path so that it is stored in my table.
    Help would be really appreciated, I am making good progress in learning the php especially with David's books but am still struggling when it comes to having to customized the code.
    The code for the upload.php is as follows,
    <?php
    class Gp1_Upload{
      protected $_uploaded = array();
      protected $_destination;
      protected $_max = 51200;
      protected $_messages = array();
      protected $_permitted = array('image/gif',
                                    'image/jpeg',
                                    'image/pjpeg',
                                    'image/png');
      protected $_renamed = false;
      public function __construct($path) {
        if (!is_dir($path) || !is_writable($path)) {
          throw new Exception("$path must be a valid, writable directory.");
        $this->_destination = $path;
        $this->_uploaded = $_FILES;
      public function getuploadpath (){
      public function getMaxSize() {
        return number_format($this->_max/1024, 1) . 'kB';
      public function setMaxSize($num) {
        if (!is_numeric($num)) {
          throw new Exception("Maximum size must be a number.");
        $this->_max = (int) $num;
      public function move($overwrite = false) {
        $field = current($this->_uploaded);
        if (is_array($field['name'])) {
          foreach ($field['name'] as $number => $filename) {
            // process multiple upload
            $this->_renamed = false;
            $this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $overwrite);   
        } else {
          $this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $overwrite);
      public function getMessages() {
        return $this->_messages;
      protected function checkError($filename, $error) {
        switch ($error) {
          case 0:
            return true;
          case 1:
          case 2:
            $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
            return true;
          case 3:
            $this->_messages[] = "Error uploading $filename. Please try again.";
            return false;
          case 4:
            $this->_messages[] = 'No file selected.';
            return false;
          default:
            $this->_messages[] = "System error uploading $filename. Contact webmaster.";
            return false;
      protected function checkSize($filename, $size) {
        if ($size == 0) {
          return false;
        } elseif ($size > $this->_max) {
          $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
          return false;
        } else {
          return true;
      protected function checkType($filename, $type) {
        if (empty($type)) {
          return false;
        } elseif (!in_array($type, $this->_permitted)) {
          $this->_messages[] = "$filename is not a permitted type of file.";
          return false;
        } else {
          return true;
      public function addPermittedTypes($types) {
        $types = (array) $types;
        $this->isValidMime($types);
        $this->_permitted = array_merge($this->_permitted, $types);
      protected function isValidMime($types) {
        $alsoValid = array('image/tiff',
                           'application/pdf',
                           'text/plain',
                           'text/rtf');
          $valid = array_merge($this->_permitted, $alsoValid);
        foreach ($types as $type) {
          if (!in_array($type, $valid)) {
            throw new Exception("$type is not a permitted MIME type");
      protected function checkName($name, $overwrite) {
        $nospaces = str_replace(' ', '_', $name);
        if ($nospaces != $name) {
          $this->_renamed = true;
        if (!$overwrite) {
          $existing = scandir($this->_destination);
          if (in_array($nospaces, $existing)) {
            $dot = strrpos($nospaces, '.');
            if ($dot) {
              $base = substr($nospaces, 0, $dot);
              $extension = substr($nospaces, $dot);
            } else {
              $base = $nospaces;
              $extension = '';
            $i = 1;
            do {
              $nospaces = $base . '_' . $i++ . $extension;
            } while (in_array($nospaces, $existing));
            $this->_renamed = true;
        return $nospaces;
      protected function processFile($filename, $error, $size, $type, $tmp_name, $overwrite) {
        $OK = $this->checkError($filename, $error);
        if ($OK) {
          $sizeOK = $this->checkSize($filename, $size);
          $typeOK = $this->checkType($filename, $type);
          if ($sizeOK && $typeOK) {
            $name = $this->checkName($filename, $overwrite);
            $success = move_uploaded_file($tmp_name, $this->_destination . $name);
            if ($success) {
                $message = "$filename uploaded successfully";
                if ($this->_renamed) {
                  $message .= " and renamed $name";
                $this->_messages[] = $message;
            } else {
              $this->_messages[] = "Could not upload $filename";
    ?>
    The code for my form page is this
    <!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>Untitled Document</title>
    </head>
    <body>
    <?php
    //THE FOLLOWING CODE IS FOR THE UPLOADING OF IMAGES AND FILES
    // set the max upload size in bytes
    $max = 51200;
    if (isset ($_POST ['submit']))
                //define the path to the upload folder
                $destination = 'uploads/';
                require_once('classes/Upload.php');
                try {
                    $upload = new Gp1_Upload($destination);
                    $upload->setMaxSize($max);
                    $upload->move();
                    $result = $upload->getMessages();
                } catch (Exception $e) {
                    echo $e->getMessage();
    // END OF UPLOADING OF IMAGES AND FILES
    ?>
    <form id="newvenue" action="" method="post" enctype="multipart/form-data" >
          <?php
               // THIS CODE DISPLAYS ERROR MESSAGES FOR THE FILE UPLOADS
              if (isset($result)){
              echo '<ul>';
              foreach ($result as $message){
                  echo "<li>$message</li>";
              echo '</ul>';
           ?>
      <table id="neweventdisplay" cellpadding="5"  border="0">
        <tr>
      <td></td>
      <td><input type="hidden" name="user_id"  value="" /></td>
      </tr>
      <tr>
      <td></td>
        <td>Organisers Name</td>
        <td><input class="input80px" id="org_name" name="org_name" type="text" /> </td>
      </tr>
      <tr>
      <td></td>
      <td><label for="image">Upload image:</label></td>
      <td><p>
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max; ?>" />
    <input type="file" name="image" id="image" />
    </p></td>
    </tr>
      <tr>
      <td></td>
      <td>Details about your upload</td>
      <td><input class="input80px" id="org_uploadcapt" name="org_uploadcapt" type="text"  /></td>
    </tr>
      <tr>
      <td></td>
      <td><input type="submit" name="submit" id="submit" value="upload"></td>
      </tr>
      <tr>
      <td class="heading"> </td>
      <td></td>
      </tr>
    </table>
    </form>
    <prep>
    <?php
    if (isset ($_POST ['submit'])){
        print_r($_FILES);}
        ?>
        </prep>
    </body>
    </html>

    Hi David
    Thank you very much for your help.  I had continued to work on the code and had worked out how to input the image path into the database but it was using the original filename, so when every it is changed it did not work.  The code in my page at that point was the following,
    <?php     // 2. NEW USER REGISTRATION<br />
            include_once ("includes/form_functions.inc.php");
            $max = 100000;
            $destination = 'uploads/';
            // START FORM PROCESSING FOR A NEW REGISTRATION
            if (isset($_POST['submit'])) { // Form has been submitted.
            $errors = array();
            // perform validations on the form data
            $required_fields = array('org_name');
            $errors = array_merge($errors, check_required_fields($required_fields, $_POST));    
            $required_numberfields = array('user_id');
            $errors = array_merge($errors, check_number_fields($required_numberfields, $_POST));
            $fields_with_lengths = array('org_name' => 36, 'org_website' => 100, 'org_contact' => 40,  'org_conemail' => 80, 'org_contel' => 30);
            $errors = array_merge($errors, check_max_field_lengths($fields_with_lengths, $_POST));
            /*Here I am using trim as well as ucwords, this function converts the first letter of each work into a capital letter,  I am using this only on the
            firstname and surname to ensure that the data is how I want it as it is going  into the database,  The better the data is preformated the better the data
            swill be within the database.*/
            $org_name = trim(strtolower(mysql_prep($_POST['org_name'])));
            $org_website = trim(strtolower(mysql_prep($_POST['org_website'])));
            $org_contact = trim(strtolower (mysql_prep($_POST['org_contact'])));
            $org_conemail = trim(strtolower (mysql_prep($_POST['org_conemail'])));
            $org_contel = strtolower (mysql_prep($_POST['org_contel']));
            $userid = $_POST['user_id'];
            $org_uploadcapt = $_POST['org_uploadcapt'];
            $image = $_FILES['image'];
            /*Here is the code that takes the variable captured from the input form and matches it  up with the appropriate field in the database.  An important point with insertion is that  the variables are in the same order as the mysql field names, there will be an error if the number of variables does not match the number of field names.  Note that there is no entry for the user id as this is an auto increment file within mysql and so is not needed to be entered*/
            if ( empty($errors) ) {
                $sql = "INSERT INTO organiser
                          (org_name, org_website, org_contact, org_conemail, org_contel, user_id, org_uploadurl, org_uploadcapt)
                          VALUES
                          ('{$org_name}', '{$org_website}', '{$org_contact}', '{$org_conemail}', '{$org_contel}', '{$userid}', '{$destination}".$image['name']."', '{$org_uploadcapt}' )";
                $result = mysql_query($sql, $connection);
                if ($result) {
                    $message = "The organiser was successfully created.<br />";
                } else {
                    $message = "I am sorry but the organiser could not be added.";
                    $message .= "<br />" . mysql_error();
                } else {
                    /* this counts the number of errors and informs the user of how many fields were
                    incorrectly entered*/
                if (count($errors) == 1) {
                    $message = "There was 1 error in the form.";
                } else {
                    $message = "There were " . count($errors) . " errors in the form.";
        } else { // Form has not been submitted.
            $org_name = "";
            $org_website = "";
            $org_contact = "";
            $org_conemail = "";
            $org_contel = "";
            $userid = "";
            $org_uploadcapt = "";
    //THE FOLLOWING CODE IS FOR THE UPLOADING OF IMAGES AND FILES
    // set the max upload size in bytes
    if (isset ($_POST ['submit']))
                //define the path to the upload folder
                // Use This On The Local Hosting Machine
                //$destination = 'C:/upload_test/';
                // Use This On The Live Server
                require_once('classes/Upload.php');
                try {
                    $upload = new Gp1_Upload($destination);
                    $upload->setMaxSize($max);
                    $upload->move();
                    $result = $upload->getMessages();
                } catch (Exception $e) {
                    echo $e->getMessage();
    // END OF UPLOADING OF IMAGES AND FILES
    ?>
    <title>Horse Events</title>
    <?php include_once("includes/meta.inc.php");?>
    <?php include_once("includes/cssfavgoogle.inc.php");?>
    <link href="css/adminpanel.css" rel="stylesheet" type="text/css" />
    <style>
    input[type="number"] {
        width:40px;
    </style>
    </head>
    <body>
    <div id="wrapper">
        <div id="admincontent">
    <form id="newvenue" action="neworganiser.php" method="post" enctype="multipart/form-data" >
          <?php if (!empty ($message)) {echo "<p class=\"message\">" . $message . "</p>";} ?>
          <?php if (!empty ($errors)) {display_errors($errors); } ?>
          <?php
              // THIS CODE DISPLAYS ERROR MESSAGES FOR THE FILE UPLOADS
              if (isset($result)){
              echo '<ul>';
              foreach ($result as $message){
                  echo "<li>$message</li>";
              echo '</ul>';
           ?>
    <br />
          <table id="neweventdisplay" cellpadding="5"  border="0">
        <tr>
      <td></td>
      <td><input type="hidden" name="user_id"  value="<?php echo $url_userid ['user_id']; ?>" /></td>
      </tr>
      <tr>
      <td> <span class="compuls">*</span></td>
        <td>Organisers Name</td>
        <td><input class="input80px" id="org_name" name="org_name" type="text" />
         </td>
      </tr>
          <tr>
          <td><span class="compuls">*</span></td>
        <td>Their Website</td>
        <td><input class="input80px" id="org_website" name="org_website" type="text" /></td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
        <td>Organisers Contact</td>
        <td><input id="org_contact" name="org_contact" type="text" />eg: Mrs Jean Kelly</td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
        <td>Contact Email</td>
        <td><input class="input80px" id="org_conemail" name="org_conemail" type="text" />
          </td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
      <td>Contact Tel No.</td>
      <td><input id="org_contel" name="org_contel" type="text" /></td>
      </tr>
      <tr>
      <td></td>
      <td><label for="image">Upload image:</label></td>
      <td><p>
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max; ?>" />
    <input type="file" name="image" id="image" />
    </p></td>
    </tr>
      <tr>
      <td></td>
      <td>Details about your upload</td>
      <td><input class="input80px" id="org_uploadcapt" name="org_uploadcapt" type="text"  /></td>
    </tr>
      <tr>
      <td></td>
      <td><input type="submit" name="submit" id="submit" value="Add Your Organiser"></td>
      </tr>
      <tr>
      <td class="heading"> </td>
      <td></td>
      </tr>
    </table>
    <a  class="delete" href="controlpanel.php">Cancel</a>
    </form>
        </div>
    I have added the code you kindly forwarded but am getting an error,  I am still trying to learn the basics of php and am unsure of what to do next, my php Upload.php now looks like
    <?php
    class Gp1_Upload{
      protected $_uploaded = array();
      protected $_destination;
      protected $_max = 100000;
      protected $_messages = array();
      protected $_permitted = array('image/gif',
                                    'image/jpeg',
                                    'image/pjpeg',
                                    'image/png');
      protected $_renamed = false;
      protected $_filenames = array();
      public function __construct($path) {
        if (!is_dir($path) || !is_writable($path)) {
          throw new Exception("$path must be a valid, writable directory.");
        $this->_destination = $path;
        $this->_uploaded = $_FILES;
      public function getMaxSize() {
        return number_format($this->_max/100000, 1) . 'kB';
      public function setMaxSize($num) {
        if (!is_numeric($num)) {
          throw new Exception("Maximum size must be a number.");
        $this->_max = (int) $num;
      public function move($overwrite = false) {
        $field = current($this->_uploaded);
        if (is_array($field['name'])) {
          foreach ($field['name'] as $number => $filename) {
            // process multiple upload
            $this->_renamed = false;
            $this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $overwrite);   
        } else {
          $this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $overwrite);
      public function getMessages() {
        return $this->_messages;
      protected function checkError($filename, $error) {
        switch ($error) {
          case 0:
            return true;
          case 1:
          case 2:
            $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
            return true;
          case 3:
            $this->_messages[] = "Error uploading $filename. Please try again.";
            return false;
          case 4:
            $this->_messages[] = 'No file selected.';
            return false;
          default:
            $this->_messages[] = "System error uploading $filename. Contact webmaster.";
            return false;
      protected function checkSize($filename, $size) {
        if ($size == 0) {
          return false;
        } elseif ($size > $this->_max) {
          $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
          return false;
        } else {
          return true;
      protected function checkType($filename, $type) {
        if (empty($type)) {
          return false;
        } elseif (!in_array($type, $this->_permitted)) {
          $this->_messages[] = "$filename is not a permitted type of file.";
          return false;
        } else {
          return true;
      public function addPermittedTypes($types) {
        $types = (array) $types;
        $this->isValidMime($types);
        $this->_permitted = array_merge($this->_permitted, $types);
      protected function isValidMime($types) {
        $alsoValid = array('image/tiff',
                           'application/pdf',
                           'text/plain',
                           'text/rtf');
          $valid = array_merge($this->_permitted, $alsoValid);
        foreach ($types as $type) {
          if (!in_array($type, $valid)) {
            throw new Exception("$type is not a permitted MIME type");
      protected function checkName($name, $overwrite) {
        $nospaces = str_replace(' ', '_', $name);
        if ($nospaces != $name) {
          $this->_renamed = true;
        if (!$overwrite) {
          $existing = scandir($this->_destination);
          if (in_array($nospaces, $existing)) {
            $dot = strrpos($nospaces, '.');
            if ($dot) {
              $base = substr($nospaces, 0, $dot);
              $extension = substr($nospaces, $dot);
            } else {
              $base = $nospaces;
              $extension = '';
            $i = 1;
            do {
              $nospaces = $base . '_' . $i++ . $extension;
            } while (in_array($nospaces, $existing));
            $this->_renamed = true;
        return $nospaces;
      protected function processFile($filename, $error, $size, $type, $tmp_name, $overwrite) {
        $OK = $this->checkError($filename, $error);
        if ($OK) {
          $sizeOK = $this->checkSize($filename, $size);
          $typeOK = $this->checkType($filename, $type);
          if ($sizeOK && $typeOK) {
            $name = $this->checkName($filename, $overwrite);
            $success = move_uploaded_file($tmp_name, $this->_destination . $name);
            if ($success) {
                $message = "$filename uploaded successfully";
                if ($this->_renamed) {
                  $message .= " and renamed $name";
                $this->_messages[] = $message;
            } else {
              $this->_messages[] = "Could not upload $filename";
      public getFilenames() {
        return $this->_filenames;
    ?>
    The error is Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE.   
    I have not worked with oop before and have only very briefly looked at the principle was on my foundation degree.

  • Uploading a file into mySQL database?

    Hello, everybody.
    Can anyone give me a code snippet or at least a hint, how could I upload a file into the BLOB field of mySQL database using JSP webpage? How do you generally store uploaded files on the server? If anyone could suggest a good algorythm of saving the files in the server's file system and saving only their URLs in the database (this was my initial idea), I would be ready to accept this as well.
    Would be appreciated for any help.

    Hi
    Fou uploading the files from client site to server user the utility given by oreilly Go to this site and down the code for uploading the source code for fileupload
    For writing this code to database use this code
    code
    import java.sql.*;
    import java.io.*;
    class BlobTest {
         public static void main(String args[]) {
              try {
                   //File to be created. Original file is duke.gif.
                   DriverManager.registerDriver( new org.gjt.mm.mysql.Driver());
                   Connection conn = DriverManager.getConnection("jdbc:mysql://agt_229/test","manoj","manoj");
                   /*PreparedStatement pstmt = conn.prepareStatement("INSERT INTO BlobTest VALUES( ?, ? )" );
                   pstmt.setString( 1, "photo1");
                   File imageFile = new File("duke.gif");
                   InputStream is = new FileInputStream(imageFile);
                   pstmt.setBinaryStream( 2, is, (int)(imageFile.length()));
                   pstmt.executeUpdate();
                   PreparedStatement pstmt = conn.prepareStatement("SELECT image FROM testblob WHERE Name = ?");
                   pstmt.setString(1, args[0]);
                   RandomAccessFile raf = new RandomAccessFile(args[0],"rw");
                   ResultSet rs = pstmt.executeQuery();
                   if(rs.next()) {
                        Blob blob = rs.getBlob(1);
                        int length = (int)blob.length();
                        byte [] _blob = blob.getBytes(1, length);
                        raf.write(_blob);
                   System.out.println("Completed...");
              } catch(Exception e) {
                   System.out.println(e);
    end of code
    this code contain both inserting into table and retrieving from table

  • Connect mysql database php

    I HAVE HOST ON YAHOO AND THIS SCRIPT DOSN'T WORK WITH YAHOO
    can u help me ....
    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_midcommerce = "localhost";
    $database_midcommerce = "DATABASE";
    $username_midcommerce = "USER";
    $password_midcommerce = "PASSWORD";
    $midcommerce = mysql_pconnect($hostname_DATABASE,
    $username_DATABASE, $password_DATABASE) or
    trigger_error(mysql_error(),E_USER_ERROR);
    ?>

    > # FileName="Connection_php_mysql.htm"
    Is that the correct filename? Shouldn't it be a php file?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "amooor" <[email protected]> wrote in message
    news:et677e$seq$[email protected]..
    > I HAVE HOST ON YAHOO AND THIS SCRIPT DOSN'T WORK WITH
    YAHOO can u help me
    > ....
    >
    > <?php
    > # FileName="Connection_php_mysql.htm"
    > # Type="MYSQL"
    > # HTTP="true"
    >
    > $hostname_midcommerce = "localhost";
    > $database_midcommerce = "DATABASE";
    > $username_midcommerce = "USER";
    > $password_midcommerce = "PASSWORD";
    > $midcommerce = mysql_pconnect($hostname_DATABASE,
    $username_DATABASE,
    > $password_DATABASE) or
    trigger_error(mysql_error(),E_USER_ERROR);
    > ?>
    >

  • Saving image in MySQL database

    Best groupmember,
    I want to save my images in a MySQL database. After storing that in the database I want to be able to present it using a servlet. Something like this (show image with id=4 from the database):
    <img src="/servlet/image?id=4">
    Would be happy to be guided to example code or tutorials about how to store images in a MySQL database using Java.
    -- Best of Times
    Peter Lauri

    Ok for storing images you'll have to use the type BLOB (=Binary Large Object) for the rest i would suggest that you take a look at the jdbc-documentation....
    this might help... :p
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html#getBlob(int)

  • Uploading images into database using webforms...

    Hi,
    I'm trying to upload images in to the database. This is possible on a normal form running the forms runtime, but how do i do it when is comes to webforms?
    Thanx in advance!

    hai roshapt
    what is the fine extension u r using.to get the images to disply in web also place the image file in the same path where u place the
    .fmx forms or create a virtual directory for images and configure that virtual directory also.
    regards
    ramesh.

  • Point me in the right direction: want to resize image & store in mysql db

    I finally accomplished one of my tasks! Which was trying to upload a jpeg image into my mysql database, and then display it in a jsp page via a servlet. I extend my thanks to the java forums greatly:)
    Now my next task I find is going to be trickier to accomplish, because I do not have enough experience working with images.
    I would like to make my first task above more efficient.
    When the user selects a jpeg file to send, I want to check the size of the image and resize it as well, before finally storing it in my Mysql database.
    I do not want to lose the resolution, nor do I want it to look distorted after it is resized. I want to keep the same proportions as the original image (I hope that proportion is the proper term). After the image is stored successfully, it will be read out of the database and displayed within a jsp page via a servlet.
    After poking around in the forums, I realized I need to get down the basics with regards to getting the properties of an image and trying to resize it. It doesn't look like it will be an easy task.
    Does anyone know of any sites that provide a good, easy to understand tutorial? Or are there any books you would recommend I read? What Java classes should I be looking into to accomplish my task?
    There are so many far more experienced programmers out there among the forums, that when I look at their code, I'm lost. I just want to understand this process better, by taking it one step at a time.
    Any help is appreciated, as always:)
    Thank You,
    Love2Java

    Load image with ImageIO
    Call getWidth() and getHeight()
    Create a BufferedImage with width and height scaled accordingly
    Get the image's Graphics2D object
    Call drawImage(), passing an AffineTransform to scale accordingly
    Output the image via ImageIO
    That should be it - you just need to read the APIs for the classes I've mentioned, and tack on whatever input/output streams you need at either end (see the java.io package).
    The only thing is:
    I do not want to lose the resolution
    Not totally sure what you mean: if you're scaling the image down to a thumbnail then by definition you're losing resolution. If you mean you want to keep the DPI resolution metadata in the image then you'll have to Google for it, the information is there but it hasn't remained in my head :o)
    But then I can't imagine why you'd need DPI metadata in a thumbnail anyway, so you can probably ignore it.

  • Upload image into mysql database residing on  remote server is not working?

    hello to all,
    i need ur help,we hav online site .
    i have to upload image(which can b from any pc) into mysql database residing on remote server of which we (don't hav actual path of that server).
    the solution i'm using is working correctly on local bt when transfer it to server it shows
    java.io.FileNotFoundException: (No such file or directory)
    i have used multipartRequest to access parameter of file type input.
    all variables and related packages r imported properly.no prblm in that.
    code is here....................................
    try {
    MultipartRequest multi = new MultipartRequest(request, ".", 500000 * 1024);
    File f = multi.getFile("uploadfile");
    out.println(f.getName());
    filename = f.getName();
    String type = multi.getContentType(f.getName());
    fis=new FileInputStream(filename);
    byte b[]=new byte[fis.available()];
    fis.read(b);
    fis.close();
    Blob blob=new SerialBlob(b);
    Class.forName("com.mysql.jdbc.Driver");
    Connection con=DriverManager.getConnection("jdbc:mysql://10.1.52.206:3306/test?user=root&password=delhi");
    String query="insert into uploads (FILENAME,BINARYFILE,) values (?,?)";
    pstmt=con.prepareStatement(query);
    pstmt.setString(1,filename);
    pstmt.setBlob(2,blob);
    int i=pstmt.executeUpdate();
    if(i>0)
    out.println("Image Stored in the Database");
    else
    out.println("Failed");
    } catch (Exception ex) {
    out.print("*******************"+ex);
    ex.printStackTrace();
    please suggest me the way to upload image to remote server** not on local server.
    its urgent.
    Edited by: JavaDevS on Jul 28, 2008 11:41 AM

    i need ur help,we hav online site .Please don't use these juvenile abbreviations. It's impolite when you're asking for assistance not to make the effort to spell out all of the words. Moreover in a forum with an international readership the use of standard English will reduce the possibility of confusion.
    I presume that your file upload is being placed in a different directory from that which you were expecting. I would suggest logging all paths (specifically filename) to see if this is an unexpected value.
    Please explain further what you mean by "local" - is this a stand-alone application, or merely running a copy of the server on your local machine and doing the transfer (via the browser) to that? Are there any other differences such as the browser used?

  • How can you upload an image to MYSQL using php?

    Ok this is a joint thread with one of my other ones because no one else  was posting on it, so I did not get what I needed, so, How can you  upload an image to mysql so when some one logs on to my site, they see  or can upload there own avatar, now there are loads of problems with  this, 1) many people don't know how, 2) It's not every day you try to  encode a image into mysql, 3) Letting people upload images into mysql  can cause traffic problem with people trying to log in. So that's it.

    Uploading images into MySQL is a bad idea, for more reasons than you mention. You should store the images in a directory on the server instead. But if you want to learn the hard way, here is the method:
    The mysql data type must be blob.
    The form enctype must be multipart, like this: enctype="multipart/form-data"
    The form input field myst be type file, like this: <input type="file" name="upload"/>
    Here is example code that prepares the variable $photodata to be inserted into the database.
      $uploadfile = $_FILES['upload']['tmp_name'];
      $photoname = $_FILES['upload']['name'];
      $uploadtype = $_FILES['upload']['type'];
      if ($uploadfile != "") {
    $tempfile = fopen($uploadfile, 'rb');
    $filesize=filesize($uploadfile);
    $width=getimagesize($uploadfile);
    $widthx=$width[0];
    $heightx=$width[1];
    if (($widthx > 102) or (heightx > 135)){
    $image_too_big = " but the image size was too large and was not submitted.";
    } else {
    $photodata = fread($tempfile, filesize($uploadfile));
    $photodata = addslashes($photodata);

  • How to upload images to MySql database.

    Hey guys so i created a insert form in dreamweaver to add to a database, its workin fine but i want to add another field to browse for and add a small image of the item. I created my insert form with a wizard and I'm not sure how to add an image uploader to it. I have a blob field in my database called "image" I'm just not sure how to add to it from my form.  Here is the code for my insert page so far:
    <?php require_once('../Connections/cbdb.php'); ?>
    <?php require_once('Zend/Date.php'); ?>
    <?php
    if (!isset($_SESSION)) {
      session_start();
    $MM_authorizedUsers = "";
    $MM_donotCheckaccess = "true";
    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
      // For security, start by assuming the visitor is NOT authorized.
      $isValid = False;
      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
      // Therefore, we know that a user is NOT logged in if that Session variable is blank.
      if (!empty($UserName)) {
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
        // Parse the strings into arrays.
        $arrUsers = Explode(",", $strUsers);
        $arrGroups = Explode(",", $strGroups);
        if (in_array($UserName, $arrUsers)) {
          $isValid = true;
        // Or, you may restrict access to only certain users based on their username.
        if (in_array($UserGroup, $arrGroups)) {
          $isValid = true;
        if (($strUsers == "") && true) {
          $isValid = true;
      return $isValid;
    $MM_restrictGoTo = "login.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
      $MM_qsChar = "?";
      $MM_referrer = $_SERVER['PHP_SELF'];
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
      $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo);
      exit;
    ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          if ($theValue == "")
        $theValue = "NULL";
       else
        $zendDate = new Zend_Date($theValue, "d/M/yyyy");
        $theValue = "'" . $zendDate->toString("yyyy-MM-dd") . "'";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    // *** Redirect if username exists
    $MM_flag="MM_insert";
    if (isset($_POST[$MM_flag])) {
      $MM_dupKeyRedirect="stock_already_exist.php";
      $loginUsername = $_POST['registration'];
      $LoginRS__query = sprintf("SELECT registration FROM stock WHERE registration=%s", GetSQLValueString($loginUsername, "text"));
      mysql_select_db($database_cbdb, $cbdb);
      $LoginRS=mysql_query($LoginRS__query, $cbdb) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      //if there is a row in the database, the username was found - can not add the requested username
      if($loginFoundUser){
        $MM_qsChar = "?";
        //append the username to the redirect page
        if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
        $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
        header ("Location: $MM_dupKeyRedirect");
        exit;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO stock (make, model, `year`, cc, fuel, doors, body, `date`, registration, keywords) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['make'], "text"),
                           GetSQLValueString($_POST['model'], "text"),
                           GetSQLValueString($_POST['year'], "text"),
                           GetSQLValueString($_POST['cc'], "text"),
                           GetSQLValueString($_POST['fuel'], "text"),
                           GetSQLValueString($_POST['doors'], "text"),
                           GetSQLValueString($_POST['body'], "text"),
                           GetSQLValueString($_POST['date'], "date"),
                           GetSQLValueString($_POST['registration'], "text"),
                           GetSQLValueString($_POST['keywords'], "text"));
      mysql_select_db($database_cbdb, $cbdb);
      $Result1 = mysql_query($insertSQL, $cbdb) or die(mysql_error());
      $insertGoTo = "stock_added.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    mysql_select_db($database_cbdb, $cbdb);
    $query_rsStock = "SELECT * FROM stock ORDER BY stockId ASC";
    $rsStock = mysql_query($query_rsStock, $cbdb) or die(mysql_error());
    $row_rsStock = mysql_fetch_assoc($rsStock);
    $totalRows_rsStock = mysql_num_rows($rsStock);
    ?>

    supersham101 wrote:
    Hey guys so i created a insert form in dreamweaver to add to a database, its workin fine but i want to add another field to browse for and add a small image of the item. I created my insert form with a wizard and I'm not sure how to add an image uploader to it. I have a blob field in my database called "image" I'm just not sure how to add to it from my form.
    Storing images in a database is generally not a good idea. Apart from bloating your database and increasing the risk of table fragmentation when images are updated or deleted, you cannot display an image directly from a database. However, if you want to do it, you will find instructions here: http://cookbooks.adobe.com/post_Upload_images_to_a_MySQL_database__PHP_-16609.html.
    The more common (and efficient) approach is to use the database to store details of the image, such as filename and caption. Then upload the image to your website's file system.
    I give step-by-step instructions how to do this in my book, "Adobe Dreamweaver CS5 with PHP: Training from the Source", but if you have reasonable skill at using PHP, you can learn how to handle file uploads from the PHP Manual at http://docs.php.net/manual/en/features.file-upload.php.

  • How to upload an image in a directory using PHP code generated by Dreamweaver?

    I have created a dynamic website with Dreamweaver and PHP, i have also created a insertform page using dreamweaver's 'Record Insertion Form Wizard' i have a field named prod_img in my MySQL database and on my form but this is a text field and i have to enter the path of the image directory to display it but this needs to have the image in the directory, i want to add a browse file field so that the image uploads to the directory by PHP.
    My code is as follows:
    <?php require_once('../Connections/dwtltd.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO special_offers (spec_img, spec_head, spec_desc, spec_call, spec_price, spec_rtn) VALUES (%s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['spec_img'], "text"),
                           GetSQLValueString($_POST['spec_head'], "text"),
                           GetSQLValueString($_POST['spec_desc'], "text"),
                           GetSQLValueString($_POST['spec_call'], "text"),
                           GetSQLValueString($_POST['spec_price'], "text"),
                           GetSQLValueString($_POST['spec_rtn'], "text"));
      mysql_select_db($database_dwtltd, $dwtltd);
      $Result1 = mysql_query($insertSQL, $dwtltd) or die(mysql_error());
      $insertGoTo = "../specialoffers.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    mysql_select_db($database_dwtltd, $dwtltd);
    $query_insertRS = "SELECT * FROM special_offers ORDER BY spec_id ASC";
    $insertRS = mysql_query($query_insertRS, $dwtltd) or die(mysql_error());
    $row_insertRS = mysql_fetch_assoc($insertRS);
    $totalRows_insertRS = mysql_num_rows($insertRS);
    ?>
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
      <table align="center" cellpadding="5">
        <tr valign="baseline">
          <td align="right" nowrap="nowrap">Add Image:</td>
          <td><span id="sprytextfield1">
          <input type="text" name="spec_img" value="" size="32" />
          <span class="textfieldRequiredMsg">A value is required.</span></span></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Offer Heading:</td>
          <td><input type="text" name="spec_head" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Offer Description:</td>
          <td><input type="text" name="spec_desc" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Phone:</td>
          <td><input type="text" name="spec_call" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">Price:</td>
          <td><input type="text" name="spec_price" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right">RTN:</td>
          <td><input type="text" name="spec_rtn" value="" size="32" /></td>
        </tr>
        <tr valign="baseline">
          <td nowrap="nowrap" align="right"> </td>
          <td><input type="submit" value="Insert record" /></td>
        </tr>
      </table>
      <input type="hidden" name="MM_insert" value="form1" />
    </form>
    Help greatly appreciated.
    I have googled, yahooed, binged etc etc and tried many tutorials but nothing goes in my favor please do not suggest to search on search engines or websites.

    Years and months later, apparently Dreamweaver CC 2014 has a "File" Form object that has a text box and Browse button.  Now I'm looking for the part that does the actual upload (which is why I wound up here).  I'm sure by now you have found a way to resolve your issue, but there it is....

  • Problem uploading images with php script.

    As a webdebdesigner i developped a cms system to upload images with php to a mysql database. Firefox version 5.0.1 for MAC and earlier have no problems with uploading through the script. But after that version it is impossible to upload images bigger then 250kb. The page where the customer chooses his image for upload stalls and the form is not sent to the actual upload script, which should validate and process the image.
    This problem only occurs in Firefox, all other browsers work just fine!
    On top of that: Giving feedback to firefox not possible for MAC.

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web site development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • FileNotFoundException Uploading image to database

    Hello
    I'm trying to upload image to databases, in my server it works perfectly but when i run the application in the hosting appear FileNotFoundException.
    This is the part of html file than call to servlet.
    <FORM ACTION="http://hosting/servlet/lordcyb3r.Connect">
    <center><h4><b>Insert image</b></h4></center><BR><BR>
         Name:
    <input type="text" class="bginput" name="nombre" value="" size="40"/><BR>
    <input type="hidden" name="c" value=""/>
    <input type="file" class="bginput" name="image" size="40"/><BR>
    Comment:
    <input type="text" class="bginput" name="comentario" value="" size="60"/><BR>
    <INPUT TYPE="SUBMIT" VALUE="Insert">
    </FORM>
    This is the get method of Connect servlet
    protected void doGet(HttpServletRequest request,
                   HttpServletResponse response) throws ServletException, IOException {
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              String nombre = request.getParameter("nombre");
              String ruta = request.getParameter("image");
              String comentario = request.getParameter("comentario");
              try {
                   Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                   Connection connection = DriverManager
                             .getConnection("jdbc:mysql://host/db?user=userid&password=psw");
                   PreparedStatement ps = connection
                             .prepareStatement("insert into imagedata values ( ?, ?, ?, ? )");
                   ps.setString(1, nombre);
                   ps.setString(2, ruta.substring(ruta.lastIndexOf("/") + 1));
                   ps.setString(3, ruta.substring(ruta.lastIndexOf(".") + 1));
                   ps.setString(4, comentario);
                   ps.execute();
                   ps = connection
                             .prepareStatement("insert into image values ( ?, ? )");
                   File file = new File(request.getParameter("image"));
                   InputStream is = new FileInputStream(file); // LINE 86 <--- HERE IS THE EXCEPTION
                   ps.setString(1, nombre);
                   ps.setBinaryStream(2, is, (int) file.length());
                   ps.execute();
                   is.close();
                   connection.close();
                   out.println("<br><br>Imagen insertada con �xito");
              } catch (InstantiationException e) {
                   out.println("<br><br>InstantiationException");
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IllegalAccessException e) {
                   out.println("<br><br>IllegalAccessException");
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (ClassNotFoundException e) {
                   out.println("<br><br>ClassNotFoundException");
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (SQLException e1) {
                   out.println("<br><br>SQLException");
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
    This is the StackTrace.
    java.io.FileNotFoundException: G-Natalia Duque.jpg (No such file or directory)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at lordcyb3r.Connect.doGet(Connect.java:86)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:95)
         at com.caucho.server.http.Invocation.service(Invocation.java:291)
         at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:339)
         at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:268)
         at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
         at java.lang.Thread.run(Thread.java:602)
    Can you help me?
    I think so the method is searching the image in the server and no in the client.
    If is this, How can i do it works?
    Thanks for your help.

    to upload the file basic thump rule is the form type is multipart form data and method should be post.
    u have to use any upload component to upload the file from the client machine to the server and then u have to upload it to the database
    baiju

Maybe you are looking for