Help in upload images???

hi every body!
please help me how can I upload images in a form from client to server???
and which class use to display images to jsp pages?
I try with ImageIcon but it didn't like I wish.
thanks in advance

hi every body!
please help me how can I upload images in a form from
client to server???depends, there are MANY ways to move images across the network, but i think you are talking about an HTML form submitting to your web/j2ee server, if that's the case, i'd check out MultiPartRequest from O'Reilly
and which class use to display images to jsp pages?no class, JSP renders HTML, which is just text, you use <img src="blah.jpg">
I try with ImageIcon but it didn't like I wish.ImageIcon is great, but it's for GUI programming, not web pages
thanks in advance

Similar Messages

  • Help in uploading image using module pool programming!!!

    hi all
       I need a help from you all...iam designing my company's Visitors Identity card...im workin in module pool programming,i need to know wat function module should i use to get jpg image n to display it...
    i hav tried it using DP_PUBLISH_WWW_URL func module but it asks for OBJID dono wat should i give...i referred SAP_PICTURE_DEMO.....
    <b>plz suggest me with some solutions to diplay image which is stored in desktop....</b>
    asha.......

    hi,
    u try this importing jpeg image  in transcation oaor .
    in that give class name as pictures and class type as ot and execute it.
    in that u import which image u want to say for suppose a DUMMY.
    FORM TOP_OF_PAGE.                                           "#EC CALLED
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
            EXPORTING
                <b>I_LOGO             = 'DUMMY'</b>
                "'ENJOYSAP_LOGO'
                IT_LIST_COMMENTARY =  GT_LIST_TOP_OF_PAGE.
    ENDFORM.                    "TOP_OF_PAGE
    this top of page u use in FM
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_BACKGROUND_ID                   = 'ALV_BACKGROUND'
         I_CALLBACK_PROGRAM                = sy-repid
         I_CALLBACK_PF_STATUS_SET          = gc_pf_status_set
         I_CALLBACK_USER_COMMAND           = GC_USER_COMMAND
        <b> I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'</b>
    this may solve ur problem.

  • Can someone help me upload images?  I get a "corrupt" error message.

    I have Macbook Pro with Lightroom - Version 2.3, Camera Raw 5.3.  I insert my SD card directly into my computer (images taken in raw format .CR2 - on a Canon Rebel T1i).  When I try to upload the images into Lightroom, I get an error message telling me the files are corrupt.  What am I doing wrong??
    Thanks in advance.

    Try contacting apple

  • Can any one help how can I include junit in upload image interface?

    I did upload image interface with jsp and servlet. I just need to know can I include this with junit? If so how? can anyone help?

    Error Message:
    Uploaded file should be of (.bmp|.gif|.jpg|.jpeg|.png|.htm|.html) type     1) Select a file of type (.bmp|.gif|.jpg|.jpeg|.png|.htm|.html) other than this from the browse button with the 1st selection of the above test case
    2) Select a file of type (.bmp|.gif|.jpg|.jpeg|.png|.htm|.html) other than this from the browse button with the 3rd selection of the above test case
    Shows uploaded image link with date and time.     1) Select a file of type (.bmp|.gif|.jpg|.jpeg|.png|.htm|.html) from the browse button with the 1st selection of first test case.
    2) Select a file of type
    (.bmp|.gif|.jpg|.jpeg|.png|.htm|.html) from the browse button with the 3rd selection of first test case.
    3) Select a file of type
    (.swf) from the browse button with the 5th selection of first test case.
    Is this unit tests?
    If so how to implement junit?

  • Uploading images with jsp-PLEASE HELP

    Hi
    I would like to allow users to upload images(photos) from the website im doing.
    i was gonna use perl which seems quite easy. Since everything else i used was jsp i thought i might try to do uploader in jsp (though its seems more difficult)
    id like to limit :
    the maximum file size to be uploaded ,
    the maximum width/height of the image file
    the list of the acceptable mime-types (Content-Types) -jpg, gif
    Any suggestions how to go about it PLEASE- ie. what packages, classes do i need- mimeparser, BufferedImage, FileFilter? cos im bit lost which classes to use.
    THANKS LOTS
    sabcarina

    This is the jsp File which helps me to upload the file
    But for this Jakarta Commons fileupload is needed which is normally provided with Tomcat 5.5
    The code is
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="org.apache.commons.fileupload.DiskFileUpload"%>
    <%@ page import="org.apache.commons.fileupload.FileItem"%>
    <%@ page import="java.util.List"%>
    <%@ page import="java.util.Iterator"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.io.File"%>
    <%@ page import="com.common.*"%>
    <!--<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Process File Upload</title>
    </head>-->
    <%
         DerivedLastNoEntity objLastNoEntity=new DerivedLastNoEntity();
         DerivedLastNoObject objLastNo=(DerivedLastNoObject)objLastNoEntity.getData(new DerivedLastNoObject(10)).get(0);
         int lastNo=objLastNo.getLastNo();
         String forwardString=null;
         StringBuffer parameters=new StringBuffer();
            DiskFileUpload fu = new DiskFileUpload();
            // If file size exceeds, a FileUploadException will be thrown
            fu.setSizeMax(1000000);
            List fileItems = fu.parseRequest(request);
            Iterator itr = fileItems.iterator();
            while(itr.hasNext()) {
              FileItem fi = (FileItem)itr.next();
              //Check if not form field so as to only handle the file inputs
              //else condition handles the submit button input
              if(!fi.isFormField()) {
              String fileName=fi.getName();
              if(fileName.length()>0)
                   fileName=(++lastNo)+fileName.substring(fileName.lastIndexOf("."));
                   File fNew= new File(application.getRealPath("/"), fileName);
                   parameters.append("&fileName=/struts-blank/"+fileName);
                   fi.write(fNew);
         else
              if(fi.getFieldName().equals("forwardString"))
                   forwardString=fi.getString();
              else
                   parameters.append("&"+fi.getFieldName()+"="+fi.getString());
         objLastNo.setLastNo(lastNo);
         objLastNoEntity.edit(objLastNo);
         System.out.println("before "+forwardString);
         if(parameters.length()>0)
              if(forwardString.indexOf("?")<0)
                   forwardString=forwardString.concat(parameters.toString().replaceFirst("&","?"));
              else
                   forwardString=forwardString.concat(parameters.toString());
         System.out.println("after "+forwardString);
         response.sendRedirect(forwardString);
    %>
    <!--<body>
    Upload Successful!!
    </body>
    </html>-->Bye for now
    CSJakharia

  • Upload Images Help

    Hello.
    I'm looking for a website with a working demo / sample code
    so I can upload several images for a single product (ID) into a
    mysql database.
    I'm using a coldfusion 8 server.
    Thanks,
    Barry McConaghey
    FireFightingNews.com

    hi every body!
    please help me how can I upload images in a form from
    client to server???depends, there are MANY ways to move images across the network, but i think you are talking about an HTML form submitting to your web/j2ee server, if that's the case, i'd check out MultiPartRequest from O'Reilly
    and which class use to display images to jsp pages?no class, JSP renders HTML, which is just text, you use <img src="blah.jpg">
    I try with ImageIcon but it didn't like I wish.ImageIcon is great, but it's for GUI programming, not web pages
    thanks in advance

  • Upload Image Help!!!

    I need to upload images from customers, i used to use Blue
    Voda, now i use Dreamweaver to create my sites. When someone
    uploads an image, they enter its location, but in the email i
    receive i get everything but the image itself, why is it that I
    cannot get the actual image any longer? I could on Blue Voda.
    Vsit this page
    Please limit your trials and to not use this page after the
    05 September 2006.
    Thanks!
    Daniel

    Blue Voda is a hosted service Dreamweaver is not. Sure the
    designer is a
    download, but you have to host with Blue Voda in order to
    publish the site.
    they are handling the image uploading and processing on the
    server for you.
    With Dreamweaver you will have to do that for yourself.
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technology, Inc.
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) ::
    http://www.adobe.com/communities/experts/
    "danieldwat" <[email protected]> wrote in
    message
    news:ed90sp$etd$[email protected]..
    >I need to upload images from customers, i used to use
    Blue Voda, now i use
    > Dreamweaver to create my sites. When someone uploads an
    image, they enter
    > its
    > location, but in the email i receive i get everything
    but the image
    > itself, why
    > is it that I cannot get the actual image any longer? I
    could on Blue
    > Voda.
    >
    >
    http://secure.getcanvased.co.nz/order/
    >
    > Please limit your trials and to not use this page after
    the 05 September
    > 2006.
    >
    > Thanks!
    >
    > Daniel
    >

  • Error message "This program cannot display the webpage when uploading images to Cafe Press

    I have had a Café Press shop for five years and except for sometimes being slow, no problems uploading images. Now, suddenly for 3 days I get the message "This program cannot display the webpage
    Most likely causes:
    • You are not connected to the Internet.
    • The website is encountering problems.
    • There might be a typing error in the address.
    What you can try:
    Check your Internet connection. Try visiting another website to make sure you are connected.
    Retype the address."
    I got the messsage about half way through the uploading of an image. People suggested using "firefox" instead of IE so I now get a similar error message from Firefox. I signed in, clicked on the image I wanted to upload and hit "upload" and get message as follows:
    Server not found
    Firefox can't find the server at members.cafepress.com.
    * Check the address for typing errors such as
    ww.example.com instead of
    [url=http://www.example.com]www.example.com[/url]
    * If you are unable to load any pages, check your computer's network connection.
    * If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
    None of this makes sense because I WAS connected to the internet (obviously) or I wouldn't have been able to sign in, go to my media basket, browse for the image and click "upload" and watch as the progress bar showed percentage of upload such as 20%, etc. and even went to 100% at times before giving me the error message. Plus I couldn't make a typing error since I wasn't typing anything but uploading an image. Any suggestions?
    Whatever your suggestion, I need step by step instructions as I am totally computer illiterate. I don't even know what a "proxy" is and don't know if I have a "firewall" as the message suggests. I have "Comodo" security and am using Windows XP.
    I contacted CP which was no help at all. All they did was tell me to clear my cache which I do after every session. Thanks
    Nancy
    http://www.cafepress.com/calendarflr

    Sounds like your desktop application is in fact running from
    a server. CHMs were identified as a security risk by Microsoft and
    are best suited to the user's PC.
    Click
    here for more information.

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

  • "file does not exist on remote server" when uploading image

    As the title says, when uploading an image im getting the
    message "file does not exist on remote server"......yet dreamwever
    has uploaded the file, its there. All other pages on my website
    work fine when uploading images. Any ideas?

    What image type is it? Is it in an images folder or the root
    directory? It would be helpful to post a link.

  • How to display uploaded image in jsp page.

    Hello,
    I am using struts 1.2.9 and and have uploaded image on the server. Now what I want to do display the image in jsp page after clicking on one link in jsp. I have tried many thing to display image in jsp page. But I am getting an error during displaying image in jsp. I have displayed absolute path in servlet. and used InputStream and outputstream to display image in jsp page.
    Can any one help.
    Thanks in advance
    Manveer Singh

    Follow this. This topic is very popular recently on the forum.

  • How do i create a website that allows customer to upload images and text?

    I need some help i have a friend who has asked me if i can create a website that allows them to upload their own images and text at their leisure.
    His company is in the car sales trade so they need to regularly be updating their stock, and this needs to be done by somebody with limited computer knowledge so ease of use is fairly important.
    I am using dreamweaver cs4 on a G5 Imac running Snow leopard 10.6.8, my skills are limited to creating uncomplicated websites but i am very keen to learn, i am aware of content management systems such as Druplal but have zero knowledge on how to use these.
    Any assistance would be greatly appreciated
    Andy Barrington
    www.andybarrington.com

    You can take a read here
    http://www.hotscripts.com/category/php/scripts-programs/classified-ads/autos/
    http://icloudcenter.com/auto-dealer-car-sales-script.htm
    Although putting together a form that would upload images and all the descriptions required seems like a fairly straghtforward project, depending on your current skill set.
    Gary

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

  • Is it possible to add an 'Upload Image' option to a form in Muse CC 2014

    Hi,
    Im building a website via Muse and BC for a movie star client who has images of herself tattooed by ardent fans. Basically, the website is a gallery for fans showcasing the very best in inked images of herself on their skin. On the contact form in Muse, I'd like to add an option somewhere for the client to upload an image of their own tattoo to be included in the gallery (which will be added/edited manually in PS).
    Is this possible without too much xtra code? Or, will I need a single page where folks can upload their image to us which will include some sort of widget? I'd like to be able to manage it though without giving out an email address if possible?
    Any help most appreciated.
    Cheers

    Hi Rohit, thank you for that.
    I do have a FormsCentral account and notice on a tutorial I found on AdobeTV, that you can specify file types. This is something I'd like to be able to do as they will be images so PSD, png, jpg etc. But just looking over on BC I see that you can add 'Attach File 250mb limit' to a form (as you advised) but I can't see where you can limit to type? Is it in there?
    Finally, will the image be uploaded to the BC server-side (if I use BC form creation method and not FormsCentral) in some type of assets folder or, will the form simply send any clients uploaded images to the specified email account within the form?
    Whoops, final finally: Do you think that it is better to use FormsCentral for this or BC? I want the page to be customised so the form sits on some b-ground artwork. The client has a famous image where she is holding a burning card invite. I have already used this and overlaid a contact form in Muse which has worked really well, so I want to create a (hidden from menu) uploaded page looking exactly the same and this page will be linked directly from the other Contact page, driving any fans there who wish to then upload an image rather than just send a general contact. I hope that makes sense?
    I guess what Im trying to find out is wether FormsCentral data gets fed back to BC in the same way a BC-created form would be seen in the dashboard area.
    Thanks Rohit

Maybe you are looking for

  • Best Practice in using Business Packages

    Hi All, Are there any Best Practices in the use of Business Package content?   Do you assign the Roles delivered by the Business Package and do you make changes to the original iViews? or Do you copy the content delivered in the Business Package to a

  • Ipod no show on desktop of itunes

    my ipod (20mb clickwheel), when docked, doesn't appear on my desktop or on my itunes- that's if i can get itunes to even open up... also when my ipod is connected i can't quit out of itunes, not even force quit- i've been trying to trouble shoot but

  • Activate change pointer for a new screen field in MM42/41

    Hi,   I created a new screen field for Article master(MM41/42/43) under basic data. If there are changes made to this new field how will the system create a corresponding IDOC? does this have something to do with the change pointer thing? Thanks, Jef

  • Parsing error IIS logs + cisco mars

    Hello everyone. Have a problem configuring event logging from IIS server to MARS. All the configuration was done with the help of the cisco's guide: http://www.cisco.com/en/US/docs/security/security_management/cs-mars/6.0/device/configuration/guide/c

  • Lion no longer available on Mac App store....

    So what do we do if we need to download Lion again? If we have Mac's which do not support Mountain Lion, but are currently running Snow Leopard, then how do we get Lion? If we need to reinstall Lion, or create a bootable USB Key for Lion, then how ca