Upload Image into Answer?

Hi all, is possible upload images into Oracle Interactive Dashboard?
And...if it is possible, where is the option for upload?
Thanks
bye

yes its possible. you will find lots of threads in OBIEE forum.

Similar Messages

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

  • I can't upload images into CS6 due to a plugin error that hasn't occurred before.

    As the title says, I keep getting an error when I try to upload an image into CS6. It hasn't done this before, and I don't know what to do. I've even tried opening my previous images I've used in works before in CS6 and they are all greyed out as well. I really need some help, any is appreciated. Thanks.

    You can't open the image file in InDesign.
    Go to File-->Place and place the image file in InDesign

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

  • Uploading images into SWF

    I didn't think so, but I thought I'd ask.
    Say I have my flash file online, and would like a user to be
    able to import an image from their computer. I won't know the file
    type or file name, eliminating some options.
    This is a very basic description of my problem, but I'm
    fairly certain I'm not able to do so. Just thought I'd ask.

    Hrm, nevermind. Looks to be doable with some server
    programming.
    Learn something new everyday :)

  • How to upload images in to custom table and display them in normal ABAP report?

    Hi Experts,
    Can anyone suggest me ,how to upload images into customised table and display thoes images in normal abap report.
    Thanks in Advance,
    Rgds,
    Anusha

    Hi Experts,
    Can anyone suggest me ,how to upload images into customised table and display thoes images in normal abap report.
    Thanks in Advance,
    Rgds,
    Anusha

  • Problem in uploading an image into a CM repository!!

    Hi All,
         I am trying to use the Fileupload element in JSP dynpage.
         My screen has the Fileupload element and a button.
         <b>I want to upload an image into a CM repository.</b>
         I have put <hbj:form id="myFormId" encodingType="multipart/form-data" > in my jsp page.
         The <b>'onClick'</b> method is <b>'onLoadFile'</b>.
         <i><b>The following is my code:</b></i>
    public void onLoadFile(Event event)
                   FileUpload fu =
                        (FileUpload) this.getComponentByName("myfileupload");
                   if (fu != null) {
                        //    Get file parameters
                        IFileParam fileParam = fu.getFile();
                        //    Get the temporary file name
                        File f = fileParam.getFile();
                        String fileName = fileParam.getFileName();
                        //    Get the selected file name
                        String ivSelectedFileName = fu.getFile().getSelectedFileName();
                        try {
                             int len = (int) f.length();
                             byte a[] = new byte[len];
                             FileInputStream fin = new FileInputStream(f);
                             fin.read(a);
                             String FileContent = a.toString();
                             IPortalComponentRequest request =
                                  (IPortalComponentRequest) this.getRequest();
                             com.sapportals.portal.security.usermanagement.IUser user =
                                  (com.sapportals.portal.security.usermanagement.IUser) request.getUser().getUser();
                             IResourceFactory factory = ResourceFactory.getInstance();
                             IResourceContext context = new ResourceContext(user);
                             RID rid = RID.getRID("/documents/test");
                             IResource resource = factory.getResource(rid, context);
                             if (resource != null) {
                                  ICollection parent =
                                       (ICollection) ResourceFactory
                                            .getInstance()
                                            .getResource(
                                            rid,
                                            context);
                                  String out = new String(FileContent);
                                  ByteArrayInputStream data =
                                       new ByteArrayInputStream(out.getBytes());
                                  IContent content =
                                       new Content(data, "text/html", data.available());
                                  IResource fileResource =
                                       parent.createResource(fileName, null, content);
                        } catch (Exception e) {
                   <b>..... REMAINING CODE...</b>
    I uploaded <b>abc.jpg (<i>size: 2KB</i>)</b>, then, an image file with the same-name is being created in the <b>/documents/test</b> folder but the size is <b>10Bytes</b> only. <b>I am not able to see the image</b> too.
    Can any1 help me plzzzz??? Would appreciate any kind of help.
    Thanks in advance.
    <b>
    Regards,
    Sai Krishna.</b>

    I would guess that this is because of the way you try to read the file contents. Maybe you should add some debug statements to find out what you're realling setting as content. It's certainly not KM's fault.
    The following sequence of statements looks wrong:
    nt len = (int) f.length();
    byte a[] = new byte[len];
    FileInputStream fin = new FileInputStream(f);
    fin.read(a);
    String FileContent = a.toString();
    IPortalComponentRequest request =
    (IPortalComponentRequest) this.getRequest();
    com.sapportals.portal.security.usermanagement.IUser user =
    (com.sapportals.portal.security.usermanagement.IUser) request.getUser().getUser();
    IResourceFactory factory = ResourceFactory.getInstance();
    IResourceContext context = new ResourceContext(user);
    RID rid = RID.getRID("/documents/test");
    IResource resource = factory.getResource(rid, context);
    if (resource != null) {
    ICollection parent =
    (ICollection) ResourceFactory
    .getInstance()
    .getResource(
    rid,
    context);
    String out = new String(FileContent);
    ByteArrayInputStream data =
    new ByteArrayInputStream(out.getBytes());
    IContent content =
    new Content(data, "text/html", data.available());
    Why don't you just pass the FileInputStream into the Content object's constructor???
    Best regards, Julian

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

  • Safari can not upload images newly imported into iPhoto. I have to shutdown iphoto and safari before the latest import of images into iPhoto is found my safari.

    When I want to upload images to facebook on safari - from a NEWLY imported album in iPhoto - Safari can not find the new album in iPhoto. Obviously the most commonly uploaded images are the recent ones. I am uploading them to a facebook page, not my own account - which is not possible from iphoto. So I have to shutdown safari and iphoto and then do the upload again. This has happened me three times now - and - well - its one of those annoying things that windows 95 could have done and super safari can't .... could apple sort this out sometime. Please.

    You'll not get a rebuttal from me. I still run into Wizard of Oz moments.
    Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
    Feedback

  • I just uploaded Adobe Illustrator trial can I transfer image into ai file???

    I just uploaded Trial ai to try to transfer a jpg image into an AI . Can that be done with the trail version??

    hi...sure can, im using the trial version at the moment too...all u need to do is open your jpg file and open a new illustrator doc, then drag and drop the jpg in...works for me...dont know if thats the technical way to do it...
    good luck

  • Need to Upload the image into XMII server from a desktop

    Hi,
    Can anyone let me know how to upload the image from my laptop on to the server which i should be using in my pages. I tried using Image Loader and Image Saver. But it lead me no where. Is there a detailed documentation for this ?
    Thanks for your help in Advance.
    Regards,
    Deepthi lakshmi.A.

    Hi Deepti,
    Could you give some details on what you are trying to achieve.
    Is this a use case scenario where images need to be uploaded by a handful of people using some web UI?
    or
    Is this a use case scenario where you wish to upload images from the harddrive of absolutely any user?
    The reason for my questions is as follows.
    If you wish to allow some high-level (technically savvy) users the ability to upload images to be shown in dynamic content for remainder of the public, you could, in theory, set up a network directory that xMII is able to see.  These High-Level users could drop their images in the folder and specify the path in a text box.
    You could go one step further and use Get Folder List action from within an Xacute transaction and display the list of images in this folder on a web UI.  Users could pick the image from the list and "Bob's your Uncle!".
    Hope this helps,
    Cheers,
    Jai.

  • Simple upload image to amazon S3 winjs for windows phone 8.1?

    Hi
    Can behind simple upload image to amazon S3 winjs for windows phone 8.1?Thank

    Yes.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Problem when trying to rename uploaded images using session value

    Hi,
    I have a form where 9 images are uploaded made into thumb nail size and then stored in a file. What I´m trying to do is rename those thumbnails from their original name to username_0, username_1, username_2 etc for each of the 9 thumbs. The username comes from the registration form on the same page. I have created a session variable for the username and am trying to use that to change to name of the image name, whilst my images are uploading and resizing the name stays as the original and not as the new username_$number. I have pasted relevant code below and would very much appreciate any help with this:
    <?php session_start();
    // check that form has been submitted and that name is not empty and has no errors
    if ($_POST && !empty($_POST['directusername'])) {
    // set session variable
    $_SESSION['directusername'] = $_POST['directusername'];
    // define a constant for the maximum upload size
    define ('MAX_FILE_SIZE', 5120000); 
    if (array_key_exists('upload', $_POST)) {
    // define constant for upload folder
    define('UPLOAD_DIR', 'J:/xampp/htdocs/propertypages/uploads/');
    // convert the maximum size to KB
    $max = number_format(MAX_FILE_SIZE/1024, 1).'KB';
    // create an array of permitted MIME types
    $permitted = array('image/gif','image/jpeg','image/pjpeg','image/png');
    foreach ($_FILES['photo']['name'] as $number => $file) {
    // replace any spaces in the filename with underscores
    $file = str_replace(' ', '_', $file);
    // begin by assuming the file is unacceptable
    $sizeOK = false;
    $typeOK = false;
    // check that file is within the permitted size
    if ($_FILES['photo']['size'] [$number] > 0 && $_FILES['photo']['size'] [$number] <= MAX_FILE_SIZE) {
    $sizeOK = true;
    // check that file is of a permitted MIME type
    foreach ($permitted as $type) {
    if ($type == $_FILES['photo']['type'] [$number]) {
    $typeOK = true;
    break;
    if ($sizeOK && $typeOK) {
    switch($_FILES['photo']['error'] [$number]) {
    case 0:
    include('Includes/create_thumbs.inc.php');
    break;
    case 3:
    $result[] = "Error uploading $file. Please try again.";
    default:
    $result[] = "System error uploading $file. Please contact us for further assistance.";
    elseif ($_FILES['photo']['error'] [$number] == 4) {
    $result[] = 'No file selected';
    else {
    $result[] = "$file cannot be uploaded. Maximum size: $max. Acceptable file types: gif, jpg, png.";
    ................CODE BELOW IS THE INCLUDES FILE THAT MAKES AND TRIES TO RENAME THE THUMBS................................................
    <?php
    // define constants
    define('THUMBS_DIR', 'J:/xampp/htdocs/propertypages/uploads/thumbs/');
    define('MAX_WIDTH_THB', 75);
    define('MAX_HEIGHT_THB', 75);
    set_time_limit(600);
    // process the uploaded image
    if (is_uploaded_file($_FILES['photo']['tmp_name'][$number] )) {
    $original = $_FILES['photo']['tmp_name'][$number] ;
    // begin by getting the details of the original
    list($width, $height, $type) = getimagesize($original);
    // check that original image is big enough
    if ($width < 270 || $height < 270) {
    $result[] = 'Image dimensions are too small, a minimum image of 270 by 270 is required';
    else { // crop image to a square before resizing to thumb
    if ($width > $height) {
    $x = ceil(($width - $height) / 2);
    $width = $height;
    $y = 0;
    else if($height > $width) {
    $y = ceil(($height - $width) / 2);
    $height = $width;
    $x = 0;
    // calculate the scaling ratio
    if ($width <= MAX_WIDTH_THB && $height <= MAX_HEIGHT_THB) {
    $ratio = 1;
    elseif ($width > $height) {
    $ratio = MAX_WIDTH_THB/$width;
    else {
    $ratio = MAX_HEIGHT_THB/$height;
    if (isset($_SESSION['directusername'])) {
    $username = $_SESSION['directusername'];
    // strip the extension off the image filename
    $imagetypes = array('/\.gif$/', '/\.jpg$/', '/\.jpeg$/', '/\.png$/');
    $name = preg_replace($imagetypes, '', basename($_FILES['photo']['name'][$number]));
    // change the images names to the user name _ the photo number
    $newname = str_replace ('name', '$username_$number', $name);
    // create an image resource for the original
    switch($type) {
    case 1:
    $source = @ imagecreatefromgif($original);
    if (!$source) {
    $result = 'Cannot process GIF files. Please use JPEG or PNG.';
    break;
    case 2:
    $source = imagecreatefromjpeg($original);
    break;
    case 3:
    $source = imagecreatefrompng($original);
    break;
    default:
    $source = NULL;
    $result = 'Cannot identify file type.';
    // make sure the image resource is OK
    if (!$source) {
    $result = 'Problem uploading image, please try again or contact us for further assistance';
    else {
    // calculate the dimensions of the thumbnail
    $thumb_width = round($width * $ratio);
    $thumb_height = round($height * $ratio);
    // create an image resource for the thumbnail
    $thumb = imagecreatetruecolor($thumb_width, $thumb_height);
    // create the resized copy
    imagecopyresampled($thumb, $source, 0, 0, $x, $y, $thumb_width, $thumb_height, $width, $height);
    // save the resized copy
    switch($type) {
    case 1:
    if (function_exists('imagegif'))  {
    $success[] = imagegif($thumb, THUMBS_DIR.$newname.'.gif');
    $photoname = $newname.'.gif';
    else {
    $success[] = imagejpeg($thumb, THUMBS_DIR.$newname.'.jpg',50);
    $photoname = $newname.'.jpg';
    break;
    case 2:
    $success[] = imagejpeg($thumb, THUMBS_DIR.$newname.'.jpg', 100);
    $photoname = $newname.'.jpg';
    break;
    case 3:
    $success[] = imagepng($thumb, THUMBS_DIR.$newname.'.png');
    $photoname = $newname.'.png';
    if ($success) {
    $result[] = "Upload sucessful";
    else {
    $result[] = 'Problem uploading image, please try again or contact us for further assistance';
    // remove the image resources from memory
    imagedestroy($source);
    imagedestroy($thumb);
    ?>
    I hope i´ve supplied enough information and look forward to receiving any help or advise in this matter.

    Use double quotes here:
    $newname = str_replace ('name', '$username_$number', $name);
    Change it to this:
    $newname = str_replace ('name', "$username_$number", $name);

  • Upload image that is not in local file system

    We have an abomination of a project where we are trying to upload employee images into our main 'People' form. The only issue is that the images exist on a SQL Server database. I can get the images onto the Oracle server easily enough but the functionality does not exist to browse to a remote server, just the local machine. Has anyone had to do something like this before? If it was just a few images we could FTP them to a mapped drive and do it 1 by 1 but we are talking about 15000 images so that is not an avenue we would care to explore. Any advice would be welcome.

    Hi,
    Please see if these threads help.
    API to load images for
    API to load images for
    Employee Photo Upload in HRMS
    Employee Photo Upload in HRMS
    Dispay employee pictures in Employee Self Service screen
    Dispay employee pictures in Employee Self Service  screen
    Regards,
    Hussein

Maybe you are looking for