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

Similar Messages

  • Problem while uploading Image to DataBase

    Hi ,
    i m getting exception while executing code below,
    is there anything to configure the data base before uploading images onto the database....
    Connection con=null;
    try{
    Class.forName("youroracledriver").newInstance();
    con = DriverManager.getConnection("url");
    PreparedStatement ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
    File file=new File("F:/servletworkspace/insertingimage/bb.jpg");
    FileInputStream fs = new FileInputStream(file);
    ps.setInt(1,15);
    ps.setBinaryStream(2,fs,(int)file.length());
    int i = ps.executeUpdate();
    if(i!=0){
    out.println("image inserted successfully");
    else{
    out.println("problem in image insertion");
    catch (Exception e){
    System.out.println(e);
    }

    To connect to database if your need to register driver and then make connection. So instead of:
    user8689318 wrote:
    Class.forName("youroracledriver").newInstance();
    con = DriverManager.getConnection("url");you should have (if you are connecting to oracle using oracle jdbc driver):
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    con = DriverManager.getConnection("jdbc:oracle:thin:@<your db listener ip>:<your db listener port>:<your db sid>", "<db user>", "<db user password");
    plus in future if you getting exception, then you should post it as well

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

  • Uploading images, building databases.

    So, I'm putting together a web page that lists products and lets a user buy them. I'm thinking that since I'm making the database from scratch, it might be a good idea to actually make a functional page for uploading data: (each product will have a picture, dimensions, price, id number, description, and stock number.) I also need to figure out how to keep the right pictures with the right boxes.
    Is it a good idea to try to make a functional page to input all my data to, or is it better to just input it on mySQL normally?
    Can I upload a picture to a mySQL database? If not, can I put a <img src> tag in mySQL?

    Hi
    What you are talking about is a CMS. Building a functional page(s) to do this is the recommended method, and even though there are many 3rd party and open source versions around my personal view is: where possible I build it myself.
    Can I upload a picture to a mySQL database? If not, can I put a <img
    src> tag in mySQL?
    You can upload your images to the database using the sql BLOB, but my personal preference is to just insert the file path for the image into the database.
    PZ

  • How to upload images into database.

    I have a employee table. I want to upload the image of the corresponding employee. How can we achieve this ??
    Edited by: Manjunath CN on Oct 14, 2008 2:15 PM

    Hi Manjunath,
    Please check Sikindar  post in  this link
    Photo Upload
    Tcode OAAD.
    Click on the Create button. Business object PREL and Docyment type HRICOLFOTO. Click on create (fill in the right personnel number in the pop up and click Continue).
    Choose the photo (as a JPG file) from the place where it is saved (e.g. hard disk). SAP will notify that the Stored Document was created succesfully.
    Photo is visible via PA10, PA20, PA30, PA40. Double-click to magnify photo.
    Best regards,
    raam

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

  • BAPI to upload images to external database

    Hi gurus,
    I need ur help despartely. I need to upload images, attachments, url, to an external database system for material master using services for object button using MM01 tcode. Using BDC we do not get this button as this is an external service. So we need bapi. Again in display mode we need to use a bapi to retrieve the attachment info from the external database. found tables like SOOD. Please advice.
    Regards.

    Connection con=null;
        try{
          Class.forName("youroracledriver").newInstance();
           con = DriverManager.getConnection("url");
       PreparedStatement ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
          File file=new File("F:/servletworkspace/insertingimage/bb.jpg");
         FileInputStream fs = new FileInputStream(file);
          ps.setInt(1,15);
          ps.setBinaryStream(2,fs,(int)file.length());
          int i = ps.executeUpdate();
          if(i!=0){
            out.println("image inserted successfully");
          else{
            out.println("problem in image insertion");
        catch (Exception e){
          System.out.println(e);
        }

  • Image upload in EP database(oracle 11)

    I have an image that is to be scanned in local machine.Now this image(in local machine) is to be uploaded into EP database(oracle 10i).
    What will be the steps to upload the Image.

    Hi,
    I would suggest saving the photos in KM Repository.
    Check the User Details iView, which can save user photos:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/09/d7fe40be6eef23e10000000a155106/frameset.htm
    If this does not suite your needs, then create your own Custom IView, to save photos in KM Repository.
    Greetings,
    Praveen Gudapati
    [Points are welcome for helpful answers]

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

  • Error while getting  image from database in SUP using ios?

    Hi All,
      Im developing native iOS application using sup 2.1.3 . Im getting error While retrieving  image from SUP database. Here i'm trying to get image from database and show in imageView.can any one help me how to fix this issue?
    In database image datatype is  'LONG Binary' .
    My table Schema:
    CREATE TABLE dba.ImagesTable (
    RowID INT NOT NULL,
    ImageName VARCHAR(20) NOT NULL,
    PhotoData LONG BINARY NOT NULL,
    IN SYSTEM
    ALTER TABLE dba.ImagesTable
      ADD CONSTRAINT ASA137 PRIMARY KEY CLUSTERED (RowID)
    ALTER TABLE dba.ImagesTable
      ADD CONSTRAINT ASA138 UNIQUE NONCLUSTERED (RowID)
    in Xcode:
                [SUP107SUP107DB synchronize];
                SUP107ImagesTable *imgTable =[[SUP107ImagesTable alloc]init];
                SUP107ImagesTableList *list =[SUP107ImagesTable findAll];
                SUP107ImagesTable * oneRecord =[list objectAtIndex:0];
                NSLog(@"rowId:%d---imageName:%@---photoData:%@---photoLenght:%d",oneRecord.rowID,oneRecord.imageName,oneRecord.photoData,oneRecord.photoDataLength);
                NSData *tempData =[[NSData alloc]init];
                SUPBigBinary *responseBinaryData = (SUPBigBinary *)oneRecord.photoData.value;
                @try {
                    [responseBinaryData openForWrite:[oneRecord.photoData length]];
                    [responseBinaryData write:tempData];
                @catch (NSException *exception) {
                    NSLog(@"exception: %@",[exception description]);
                UIImageView *imgView =[[UIImageView alloc] initWithFrame:CGRectMake(50,50,100,100)];
                [self.window addSubview:imgView];
                UIImage * tempImage =[UIImage imageWithData:tempData];
                imgView.image = tempImage;
                [responseBinaryData close];
    Error Log:
    2014-04-02 18:42:15.150 SUP102[2873:70b] rowId:1---imageName:Apple---photoData:SUPBigBinary: column=c pending=1 allow_pending_state=1 table=sup107_1_0_imagestable mbo=0x0 key=(null) ---photoLenght:90656
    Printing description of responseBinaryData:
    <OS_dispatch_data: data[0xc891b40] = { leaf, size = 90656, buf = 0x1213a000 }>
    2014-04-02 18:42:33.304 SUP102[2873:70b] -[OS_dispatch_data openForWrite:]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.305 SUP102[2873:70b] exception: -[OS_dispatch_data openForWrite:]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.305 SUP102[2873:70b] -[OS_dispatch_data close]: unrecognized selector sent to instance 0xc891b40
    2014-04-02 18:42:33.306 SUP102[2873:70b] [ERROR] [AppDelegate.m:497] NSInvalidArgumentException: -[OS_dispatch_data close]: unrecognized selector sent to instance 0xc891b40

    This thread talks about uploading image to SAP from a IOS device,Sending Image to SAP via iOS Native app (SUP 2.1.3)
    Midhun VP

  • Uploading image stored in blob & retrieving to disk

    Hi there...
    Any help will be much appreciated !!!
    I have the following to tasks that I needhelp figuring out:
    I'm using the intermedia WebAgent and interface with
    a jsppage.
    1. I have a table with a field that store images. The field
    isdeclared as blob datatype. My task is to upload images to the
    database from a client side and store it in to server db in this field.
    The examples thatI've got from technet are using fields declared
    as ordImage.
    Can you give me example on how to do this when the db field is a blob ?
    2. On the other problem, I need to retrieve an image from the same field,
    but be able tostore it directly to a local disk at client side.
    Again, the examples I haveis on displaying the image directly on
    the web page.
    Can you give meexample or way how to retrieve the image and store it
    directly to the disk?
    Thanks..
    null

    Some usefull code examples are available @ :
    http://technet.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm
    and
    http://technet.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/LOBSample/LOBSample.java
    hope these help

  • Storing jpg or gif images in database

    Hi,
    I want to store the images from system folder to database.
    Ex: "c:/images"
    is the foldername
    I want to access this folder from JSP and want to store a selected image from the user to database and getting back that image to view by a query. so how can i achive this.....

    Hi All,
    I have 2 things to discuss in this thread.
    First to store Images in Database: We can store Images as Binary content in the Database with the Datatype as BLOB. This is possible in ORACLE. I am not sure what the Datatype is in other RDBMS. Please refer to Vendor documentation. After storing, the content can be retrieved and displayed in the pages as image resources using a Servlet. The Servlet will only render the content of the Image.
    Second to load Images from User's Systems folder: Why do you have such a requirement? Even then, you need to use any common techniques like Multipart form to upload the specific image file to the Server. Kindly read Oreilley's Multipart Request Form Object example for implementation.
    Thanks and regards,
    Pazhanikanthan. P

  • How to upload images to a DB and then view them in the site?

    Hi
    I have a form, and i want it to insert some data on a DB, so
    that the site can display that information. But i'm not able to
    upload images or files, because dreamweaver does not have a file
    upload option.
    I'm using PHP, can anyone help me on how to upload a image
    and display it on the web site?

    > I don't think its possible to store files in a
    > database.
    It is. But it's not a great way to do things.
    > store it's path in the DB
    Actually, what you want to store in the DB is the filename
    only. Put the
    path into the HTML. That way you don't have to change every
    record when you
    rename a folder.
    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
    ==================
    "IndioDoido" <[email protected]> wrote in
    message
    news:e1rdmu$819$[email protected]..
    > Hi there!
    >
    > I don't want to upload a image to a DB...i want to
    upload it to a folder
    > but
    > store it's path in the DB. I don't think its possible to
    store files in a
    > database.
    > After the upload i want to display the image on the
    page, with its name
    > and
    > discription, in other words, with the information
    uploaded from the web
    > form
    > created with dreamweaver record insertion form.
    >

  • How to upload Images in Forms 6i

    Dear all,
    How to upload images in Forms 6i and save it in database. Please anyone help me with example.
    Thanking you
    Shekhar

    why do you need an active/X for this?
    Can't you just create 2 default blocks on dept and on emp.
    Use the relationship wizard to define the relation. and set the number of records displayed for the emp block to 10?
    This will give you all you need with no hussle.

Maybe you are looking for

  • Oracle error - oracle initializarion or shutdown in progress

    Hi Experts, When I tried to connect to oracle there was an error "oracle initializarion or shutdown in progress" then i tried the following steps and the results are as below. still i could not connect to oracle. Kindly suggest me a good solution. C:

  • Word Files in Java

    Hi everybody, I know this question has probably been asked a zillion and one times before, but I think I might be putting a bit of a new spin on it. Anyway, I was looking at the Jakarta API's to read and write Microsoft Word Files in Java, and I coul

  • 11.5.10.2 Technology Stack Validation Patch - Database validation report

    Hi all, I am trying to upgrade Oracle EBS 11.5.10 to 11.5.10.2. As per the Oracle instruction i am running 11.5.10.2 Technology Stack Validation utility. For Node Type admin, Conc, Web, Forms its working fine. But when i run this for Database, its gi

  • "Seamless Tiling" Photos

    I have just changed from Paint Shop Pro to Photoshop Elements 9. I have looked exhaustively in PSE and cannot find how to edit a photo with a "seamless tiling" effect. This is not "mosaic" or any of the other textures I see in PSE. When working on a

  • SAP Netweaver 2004s installation Error

    need help, during the installation of NW04s i encountered this error when adjusting nametab process. see details below. WARNING 2007-06-23 23:16:27 Execution of the command "/usr/sap/BIW/SYS/exe/run/dipgntab -rwr40 -srctt DDNTT -srctf DDNTF -dsttt DD