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.

Similar Messages

  • 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

  • ADD FILES FOR UPLOAD - IMAGE PATHS DO NOT WORK IN WIDGETS

    Hi There
    I'm trying to add my own images to a widget I bought from Qooqee - the Wrapper_v2 image slider. But when I try to add my own images with the image path it doesn't work. I've tried adding the image with 'Add Files for Upload' - and then using the full path which I get from right clicking on it in the assets panel - but it still doesn't work.
    Most of the widgets require you to either specify the image path, or an external URL. I do not want to use a third party image hosting site to get URL's for every image I want to use on the site - so I just need to know what I'm doing wrong with the Add files for Upload - why do my file paths not work in the widgets?

    Provide the name of the program you are using so a Moderator may move this message to the correct program forum
    This Cloud forum is not about help with program problems... a program would be Photoshop or Lighroom or Muse or ???
    Also, you need to ask for help from the widget maker

  • 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

  • Uploading image path

    Hi All,
    in my requirement i need the  path where the image will be uploading in  the server dynamically.
    Thannks,
    Ramani.

    You can try uploading the images dynamically to the Content Management inside the Portal.
    in my file upload program i use following path
    RID pathRID = RID.getRID("/documents/Public Documents/PICDATA"); //Root Directory
    where /documents/Public Documents/PICDATA is existiing folder in KM on portal.
    If you are using webdynpro for Java then make use of FileUpload UI element and KM API's
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a099a3bd-17ef-2b10-e6ac-9c1ea42af0e9]
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71]
    Greetings
    Prashant

  • Upload Image Files into IFS

    Dear Members,
    I am trying to upload files from my local disk to the IFS. There is no problem about uploading txt files. But i could not upload the image files like ".tif".
    Is there anyone who can help me urgently please?
    Here is the part of my source code..
    DocumentDefinition newDocDef = new DocumentDefinition(ifsSession);
    newDocDef.setName(filename);
    newDocDef.setContentPath(localpath);
    newDocDef.setAddToFolderOption(runtime);
    Document doc = (Document)ifsSession.createPublicObject(newDocDef);

    Dear Sir,
    This topic is very urgent for me, and I will be very happy for your help.
    I have changed my code like this.
    ClassObject co = classUtils.lookupClassObject("DOCUMENT");
    Collection c = ifsSession.getFormatExtensionCollection();
    Format f = (Format) c.getItems("tif");
    DocumentDefinition newDocDef = new DocumentDefinition(ifsSession);
    newDocDef.setContentPath(localpath);
    newDocDef.setAddToFolderOption(runtime);
    newDocDef.setName(filename);
    newDocDef.setClassObject(co);
    newDocDef.setFormat(f);
    TieDocument doc = (TieDocument)ifsSession.createPublicObject(newDocDef);
    And the error message is here.
    oracle.ifs.common.IfsException:
    IFS-30002: Unable to create new LibraryObject oracle.ifs.common.IfsException:
    IFS-32225: Error storing reference to content object 22,432 in media InterMediaBlob java.sql.SQLException:
    ORA-00911: invalid character
         void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)           DBError.java:187      void oracle.jdbc.ttc7.TTIoer.processError()           TTIoer.java:241      void oracle.jdbc.ttc7.Oall7.receive()           Oall7.java:543      void oracle.jdbc.ttc7.TTC7Protocol.doOall7(byte, byte, int, byte[], oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int, oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int)           TTC7Protocol.java:1477      int oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(oracle.jdbc.dbaccess.DBStatement, byte, byte[], oracle.jdbc.dbaccess.DBDataSet, int, oracle.jdbc.dbaccess.DBDataSet, int)           TTC7Protocol.java:888      void oracle.jdbc.driver.OracleStatement.executeNonQuery(boolean)           OracleStatement.java:2004      void oracle.jdbc.driver.OracleStatement.doExecuteOther(boolean)           OracleStatement.java:1924      void oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()           OracleStatement.java:2562      int oracle.jdbc.driver.OraclePreparedStatement.executeUpdate()           OraclePreparedStatement.java:452      boolean oracle.jdbc.driver.OraclePreparedStatement.execute()           OraclePreparedStatement.java:526      boolean oracle.ifs.server.S_LibrarySession.execute(java.sql.PreparedStatement)           S_LibrarySession.java:14518      oracle.sql.BLOB oracle.ifs.server.S_MediaBlob.createBlobReference(java.lang.Long, java.lang.String)           S_MediaBlob.java:398      java.io.OutputStream oracle.ifs.server.S_MediaBlob.getOutputStream(java.lang.Long, java.lang.String)           S_MediaBlob.java:240      java.io.OutputStream oracle.ifs.server.S_MediaBlob.getOutputStream(java.lang.Long)           S_MediaBlob.java:225      java.lang.Long oracle.ifs.server.S_Media.setContentStream(java.io.InputStream)           S_Media.java:1741      void oracle.ifs.server.S_Media.setContent(oracle.ifs.server.S_LibraryObjectDefinition)           S_Media.java:1680      void oracle.ifs.server.S_ContentObject.setContent(oracle.ifs.server.S_LibraryObjectDefinition)           S_ContentObject.java:402      void oracle.ifs.server.S_ContentObject.extendedPreInsert(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_ContentObject.java:239      void oracle.ifs.server.S_LibraryObject.preInsert(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibraryObject.java:1644      oracle.ifs.server.S_LibraryObjectData oracle.ifs.server.S_LibraryObject.createInstance(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibraryObject.java:2711      oracle.ifs.common.AttributeValue oracle.ifs.server.S_LibrarySession.createSystemObjectInstance(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:8365      void oracle.ifs.server.S_Document.setContentObject(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition, oracle.ifs.server.S_ContentQuota, boolean)           S_Document.java:475      void oracle.ifs.server.S_Document.extendedPreInsert(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_Document.java:313      void oracle.ifs.server.S_LibraryObject.preInsert(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibraryObject.java:1644      oracle.ifs.server.S_LibraryObjectData oracle.ifs.server.S_LibraryObject.createInstance(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibraryObject.java:2711      oracle.ifs.server.S_LibraryObject oracle.ifs.server.S_LibrarySession.newLibraryObject(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:8159      oracle.ifs.server.S_PublicObject oracle.ifs.server.S_LibrarySession.newPublicObject(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:8200      oracle.ifs.server.S_PublicObject oracle.ifs.server.S_LibrarySession.newPublicObject(oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:8182      oracle.ifs.server.S_LibraryObjectData oracle.ifs.server.S_LibrarySession.DMNewPublicObject(oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:7841      oracle.ifs.server.S_LibraryObjectData oracle.ifs.beans.LibrarySession.DMNewPublicObject(oracle.ifs.server.S_LibraryObjectDefinition)           LibrarySession.java:8015      oracle.ifs.beans.PublicObject oracle.ifs.beans.LibrarySession.NewPublicObject(oracle.ifs.beans.PublicObjectDefinition)           LibrarySession.java:5373      oracle.ifs.beans.PublicObject oracle.ifs.beans.LibrarySession.createPublicObject(oracle.ifs.beans.PublicObjectDefinition)           LibrarySession.java:2985 Process exited with exit code 0.

  • 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/

  • Procedure and syntax for placing image paths in mysql fields please

    I set up a directory type data base with 10 varchar fields. This directory presents info on the people at the company in both a master and detail display. Works fine. Now I want to add a thumbnail photo to display on the master page and a larger photo to display on the detail page. The photos are of each employee. I want to store the photos in a separate image folder, not in the database itself. Does anyone know the procedure to setting this up? I have done several searchs for a solution to this quest but the answers found are short on info. It would be very helpful to learn the step-by-step procedure using dreamweaver as well as the exact syntax that would go into the field that would call for the correct photo to be shown when the company directory is displayed, both in the master page and the detail page. Thanks.

    Nalini,
    you can use the web.show_document built-in in Forms to open a new Browser window wit a request to a URL that reads and serves teh image from the database. Forms9i Forms allows you to use Javascript within web.show_document which may be required to obtain a handle to the opened window fur further reference. All you need is to write a Java Servlet to read the image from the database and pass the record's unique ID with the Forms URL request. I don't have a servlet code for you, but if you serach teh Web I woudl be surprised if you don't find a sample.
    Fran

  • Uploading images - resolution problems

    Hi all,
    We have been trying to upload images - signatures into ECC from SE78 - the length and width of the image is changed - 82 mm becomes 97 mm on upload.
    I believe this is due to some system setting / config around image resolution.
    can anyone give me some valuable inputs on the same.
    - Surya.

    Hi
    After uploading the image,edit the technical attributes - increase the resolution and check the box - reserve height automatically.
    Thanks
    Vijay
    PLZ reward points if helpful

  • 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?

  • Upload/download image into Mysql

    Hi there,
    I'm trying to place an Image object into a mysql database, and then also have the ability to download it. I'm using a BLOB column type to store the image. I dont really know how to do this, i've looked at http://forum.java.sun.com/thread.jsp?forum=48&thread=446603 which is kind of relavant but I just want to load the image.
    Any help would be cool,
    Steve

    That is exaclty what he is doing, if you notice
    dPhoto = new ImageIcon(b);he has created a new image that he can now display in a swing gui

  • Image path not storing in sql database

    Hello,
    I have read here on the forum how to upload an image to server and store path in  your database, the image uploads correctly to the correct folder on my server but the image path does not get stored on my sql database (not local hosting). I receive the error: The file has been uploaded, and your information has been added to the directory. Column 'image' cannot be null.
    My database has the following columns:
    id
    datum
    image
    sectie
    My code is as follows:
    <?php require_once('Connections/dbTroch.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;
    mysql_select_db($database_dbTroch, $dbTroch);
    $query_rs_aanbod = "SELECT * FROM tblSlideshow ORDER BY id ASC";
    $rs_aanbod = mysql_query($query_rs_aanbod, $dbTroch) or die(mysql_error());
    $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    $totalRows_rs_aanbod = mysql_num_rows($rs_aanbod);
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    $target = "images/slides/";  //This is the directory where images will be saved// 
    $target = $target . basename( $_FILES['image']['name']); //change the image and name to whatever your database fields are called//
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add-photos-aanbod")) {
      $insertSQL = sprintf("INSERT INTO tblSlideshow (image, sectie) VALUES (%s, %s)",
                           GetSQLValueString($_POST['file'], "text"),
                           GetSQLValueString($_FILES['image']['name'], "text"));
    //This code writes the photo to the server//
    if(move_uploaded_file($_FILES['image']['tmp_name'], $target))
    //And confirms it has worked//
    echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
    else {
    //Gives error if not correct//
    echo "Sorry, there was a problem uploading your file.";
      mysql_select_db($database_dbTroch, $dbTroch);
      $Result1 = mysql_query($insertSQL, $dbTroch) or die(mysql_error());
    ?>
    <!doctype html>
    <html>
    <meta charset="utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Troch Project Solutions - Admin - Toevoegen</title>
      <link rel="stylesheet" href="css/foundation.css" />
      <link rel="stylesheet" href="css/layout.css" />
      <!-- Fonts
      ================================================== -->
      <script type="text/javascript" src="//use.typekit.net/vob8gxg.js"></script>
      <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
      <!-- jQuery
      ================================================== -->
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
      <script src="js/vendor/modernizr.js"></script>
    </head>
    <body>
        <div class="row">
          <div class="large-8 medium-8 small-8 large-centered medium-centered small-centered columns intro">
              <h2 class="subheader text-center">Admin</h2>
              <p><a>Log uit</a></p>
              <p><a href="admin.php">Terug naar Admin menu</a>
              <h4>image toevoegen naar aanbod slideshows:</h4>
              <form action="<?php echo $row_rs_aanbod['']; ?>" method="POST" name="add-photos-aanbod" id="add-photos-aanbod" enctype="multipart/form-data">
              <table>
                    <tbody>
                         <tr>
                              <td><label for="image">Kies foto:</label></td>
                              <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
                        <tr>
                              <td>Sectie:</td>
                              <td><select name="sectie" id="sectie" option value="sectie">
                                <?php
    do { 
    ?>
                                <option value="<?php echo $row_rs_aanbod['sectie']?>"><?php echo $row_rs_aanbod['sectie']?></option>
                                <?php
    } while ($row_rs_aanbod = mysql_fetch_assoc($rs_aanbod));
      $rows = mysql_num_rows($rs_aanbod);
      if($rows > 0) {
          mysql_data_seek($rs_aanbod, 0);
          $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    ?>
                              </select></td> 
                        </tr>
                        <tr>
                            <td><input type="Submit" name="Add" id="add" value="Toevoegen" /></td>
                        </tr>
                </tbody>
            </table>
            <input type="hidden" name="MM_insert" value="add-photos-aanbod" />
        </form>
          </div><!-- end large-8 -->
        </div><!-- end row -->
    <script src="js/vendor/jquery.js"></script>
    <script src="/js/vendor/fastclick.js"></script>
    <script src="js/foundation.min.js"></script>
    <script>
                $(document).foundation();
            </script>
    </body>
    </html>
    <?php
    mysql_free_result($rs_aanbod);
    ?>
    I cannot work out what is wrong and I would appreciate any help on this. Thanks

    Your form field and array variable names do not match
    <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
    GetSQLValueString($_POST['file'], "text"),

  • How can I read the images' path in the stored catalog?

    I'm really new to pluginu development and LR. I have a problem finding the right methods to execute my intentions.
    I'd like to get the real path(s) of the pictures in the catalog, so that my external plugin can use them for further processing.
    I know Lightroom stores the catalog in C:\Users\[user name]\Pictures\Lightroom\Lightroom 5 Catalog.lrcat. But I want to get the actual path to each .jpg inside that catalog and write that path into a simple file (e.g. .txt) from which my plugin can read the path and use the images chosen by the user in LR.
    Then my plugin stores the processed images with tags into a file which should be read by LR. I don't know if it's so easy. Maybe it must create an extra collection for the catalog?
    The thing is that the Lightroom 5 manual isn't really helpful. And it would be great if someone could help.

    Thank you. I already figured it out by searching the whole internet
    But there's a thing bugging me. I want to delete the log file in which all paths are stored because everytime I run the plugin I get duplicates of the paths.
    So I thought of removing the existing log file before every time I use the plugin.
    I tried LrTasks.execute("del %HOMEPATH%\\Documents\\photosPath.log"). But nothing happens. When I use my personal path then it works pretty well. But I want it to work on any computer....

  • 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.

  • How can i call this file path into my bsp-html  to display the images?

    Hi
    I have a file path for an image like c:/test_logo.bmp.
    How can i call this file path into my bsp-html  to display the images?
    moosa

    Try this...
    Can i have  sample code in BSP-HTML to display images?

Maybe you are looking for