Dynamically set image path

Hello all,
I've created a XFA Dynamic form that imports a number of records from one of our local databases. One of these fields is the path to an image. I would like to set an image field to that url... or, better still, embed the image into the .pdf form itself.
Everything that I've read has told me that the only way to do so is to set the image field's raw value to a base64 string representation of that image. This isn't an option, as I have no way to convert that image to base64.... unless I can do so via SQL or javascript. I've been trying to do this for a few days with no luck.
I figure that I'm not the only one who has had this porblem. I was hoping that someone out there has developed a solution that they would be willing to share. I'd appreciate any help that anyone might be able to offer. Thanks =)
- Scott

Hi there,
Thanks for your reply. The URL field is useful only to set a default image path. under the binding tab, when I bind the image to the url from a data connection, the url is displayed as text within the image field. No image appears.
The only solution that I've found online is to somehow get the image converted to base64... the issue is that the only technologies that I have available to me are SQL or javascript... neither of which were designed to convert images to base64.
Does onyone know where I can find a javascript function to convert an image to base64?
- Scott

Similar Messages

  • Setting Image Path

    Hi,
    Merry Easter to All of You!..
    i am facing a problem in setting the dynamic image path in crystal report
    the path is stored in Database field,and physical images are stored in a folder
    the path specified is relative path and works fine when the report is run directly , but it seems that the report runs in temp folder when called from vb.net windows application.
    hence the relative path specified w.r.t to database field fails when called from application.

    Download SP 0 for CR 2008 from here:
    https://smpdl.sap-ag.de/~sapidp/012002523100007528552008E/cr2008_sp0.zip
    Next, see [this|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do] note on how to work with image in Crystal Reports.
    Ludek

  • Set image path in java class library

    Hi,
    I created a java class library project and made .jar file. My java class library contains .jpg files in separete folder named as Images. My .jar file contains list of classes and image folder also but when i am using .jar file in applet. java class library is working but images are not shown. Let me know how to create imageicon to show images also in the class library

    ImageIcon icon = new ImageIcon(getClass().getResource(path-to-file));

  • Creating Symbol Instances containing a dynamically set image - Help Needed

    I'm working on a site prototype that has many rollover images in the navigation. Each image is unique, but the rollover and rollout code is identical. I'm trying to create a single symbol that can be used for all of the rollovers, but need some help figuring this out, as it will significantly speed up my work.
    I think the pseudocode would work like this:
    Create a symbol that contains a default rollover image.
    In the symbol, add the rollover and rollout code. This adjusts transparency from 0 -> 100 and back.
    Create instances of the symbol over each item in the nav.
    For each instance, set a variable containing the name of the rollover image to be used.
    In that symbol instance, get the variable value.
    In that symbol instance, use the image name in the variable to replace the default image.
    Question: How do I make step 4-6 work? I have 1-3 working smoothly.P.S. My last dev work was waaaaay back with Director, PHP and ColdFusion. I still get basic principles such as using functions, objects, instances, inheritance etc, but the language has changed. And I have very very little experience with the DOM.
    Appendix: How I'm Doing This Manually
    There's a background image of the nav showing all of the unselected states
    Each item in the nav has a corresponding rollover image, in a series of elements layered on top of nav element. Each rollover has opacity initially set to 0%.
    Each image element has rollover, rollout and click triggers. Rollover and rollout triggers are identical for each. There's also a little more code with rollout that provides a quick fade. This means lots of copying identical code. I hate to think about having to change any part of that code.
    Thanks! Chassy

    Hi there,
    Perhaps a more simple solution would be to set up 1 global function that handles over/out states for all your buttons. On mouseenter/mouseleave of each button you would call this function to fade in/out your rollover graphic.
    Example:
    http://www.timjaramillo.com/code/edge/rollover4_multiple_btns
    Source:
    http://www.timjaramillo.com/code/edge/_source/rollover4_multiple_btns.zip
    Code on Stage.compositionReady (note there are btn symbols called btn_1, btn_2, btn_3, and all have an over state called "over" in them):
    var array_btns = ["btn_1", "btn_2", "btn_3"];// array to hold all your btns
    function setup_btns()
              // iterate through array_btns, add "mouseenter" and "mouseleave" for all
              for (var i=0; i<array_btns.length; i++){
                        // hide "over" state initially
                        sym.getSymbol( array_btns[i] ).$("over").hide();
                        sym.$( array_btns[i] ).mouseenter({obj:array_btns[i]}, function(e){
                                  var btn = e.data.obj;
                                  sym.getSymbol(btn).$("over").fadeIn(500);// show "over" graphic
                        sym.$( array_btns[i] ).mouseleave({obj:array_btns[i]}, function(e){
                                  var btn = e.data.obj;
                                  sym.getSymbol(btn).$("over").fadeOut(200);// hide "over" graphic
    setup_btns();

  • How to set image source path in formsweb.cfg file in forms 11g

    Hi,
    I had written HTML code in the formsweb.cfg file in forms 11g. In the below code i am unable to retrive image file(i.e., .gif, .jpeg) from the server or local machine.
    In the below HTML code i set image source in the image tag as below:
    <img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_04.GIF"
    Is this correct path to fetch the images from the server or local machine .
    Please help me out how to set path for image in html or is there any alternate process to retrive images.
    Here is the code :
    [INDIVIDUALUAT]
    workingDirectory=D:\Aims10dev\Work
    form=LMstartup.fmx
    userid=rmenu/rmenu@RLIFEQA64
    codebase=/forms/java
    imageBase=codebase
    width=1005
    height=750
    WebUtilArchive=/forms/java/frmwebutil.jar,/forms/webutil/jacob.jar
    WebUtilLogging=off
    WebUtilLoggingDetail=normal
    WebUtilErrorMode=Alert
    WebUtilDispatchMonitorInterval=5
    WebUtilTrustInternal=true
    WebUtilMaxTransferSize=16384
    baseHTMLjinitiator=webutiljini.htm
    baseHTMLjpi=webutiljpi.htm
    archive_jini=frmall_jinit.jar,life-icons-round.jar,Agilis_Icon.jar,life_Icon.jar,personalize.jar,hyperlink.jar,amazingbutton.jar
    archive=frmall.jar
    separateFrame=False
    lookandfeel=Generic
    EndUserMonitoringURL=True
    usesdi=yes
    #HTMLbeforeForm= <table width="1005" border="0" cellspacing="0" cellpadding="0"><tr><td width="200"><img src="/forms/html/agilis-life-logo.gif" width="200" height="80" /></td><td width="10"><img src="/forms/html/agilis-life-new11_02.gif" width="36" height="80" /></td><td width="805" valign="top" background="/forms/html/agilis-life-new11_03.gif"></td></tr></td></tr></table>
    HTMLbeforeForm=<body topmargin="0" leftmargin="0" > <table width="1005" height="100" border="0" cellspacing="0" cellpadding="0"><tr><td width="200" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-logo.gif" width="200" height="80" /></td><td width="10" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_02.gif" width="36" height="80" /></td><td width="550" valign="bottom" ><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_03.gif" width="550" height="80" /></td><td valign="bottom"><table width="219" height="90" border="0" cellspacing="0" cellpadding="0"><tr><td height="36" valign="bottom" align="center"><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agile-logo.jpg" height="36"></td></tr><tr><td height="10" valign="bottom"> <div align="right"><span style="font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; text-decoration:none; color:#00000; " >Home | Change Password | Logout</span></div></td></tr><tr><td colspan="3" valign="bottom"><img src="E:\Oracle\Middleware\Oracle_FRHome1\tools\web\html\agilis-life-new11_04.GIF" width="100%" height="39" /></td></tr></table></td></tr></td></tr></table></body>

    AFAIK, this is not the correct way to set the image location.
    We call the working directory as context, so inside the context root along with WEB-INF, maintain a folder with name img and put all the images in that directory.
    You can use either .\<image_folder> or the optimum way would be (if you are using JSPs) to use getContext() method and traverse accordingly.
    FYI,,, using getContext() will give you context root directory, from there it is as simple as accessing any other folder.
    Hope this answers your question.
    Cheers,
    Jeets.

  • Image path sets ( servername) instead of \\servername

    Due to a hardware meltdown I have had to rip the NW server out of the tree
    and install a new one.
    I have re-installed the server NW65sp8 and reinstalled ZENworks for Desktops
    7
    Now, When I set an imaging job on a workstation I browse to the server etc
    and set the file path.
    When I click apply or ok leave the object and go back in the path has
    changed;
    eg
    (ZFDSRVSR) USER\zenimg\ws_master.zmg
    instead of
    \\ZFDSRVSR\USER\zenimg\ws_master.zmg
    Any ideas on how I fix this?
    Manual imaging works ok. I have deleted the ws object and re imported into
    eDir
    Tom

    I have resolved this.
    >>> On 21/07/2010 at 12:54 p.m., in message
    <[email protected]>,
    Tom Cummings<[email protected]> wrote:
    > This is turning out to be serious ant not server related. I installed a
    > new
    > ZFD7 server into a new container. Setting an image path on using that
    > server reproduces the same problem.
    >
    > Help! :‑(
    >
    >
    >
    >>>> On 20/07/2010 at 9:07 AM, in message
    > <[email protected]>,
    > Tom Cummings<[email protected]> wrote:
    >> Due to a hardware meltdown I have had to rip the NW server out of the
    >> tree
    >> and install a new one.
    >>
    >> I have re‑installed the server NW65sp8 and reinstalled ZENworks for
    >> Desktops
    >> 7
    >>
    >> Now, When I set an imaging job on a workstation I browse to the server
    >> etc
    >> and set the file path.
    >>
    >> When I click apply or ok leave the object and go back in the path has
    >> changed;
    >>
    >> eg
    >>
    >> (ZFDSRVSR) USER\zenimg\ws_master.zmg
    >>
    >> instead of
    >>
    >> \\ZFDSRVSR\USER\zenimg\ws_master.zmg
    >>
    >> Any ideas on how I fix this?
    >>
    >> Manual imaging works ok. I have deleted the ws object and re imported
    >> into
    >> eDir
    >>
    >> Tom

  • Screen Painter Image Button cannot set relative path

    Hi,
    I am using screen painter to create a UI form and i put image into each button.  The form can run properly in my PC due to the image path is under my local path.  However, the button is gone when i install the UI form in other PC.  When using button object in screen painter and it not allow me to set the relative path.  Anyone can help??
    Cheers,
    Anna

    Hi Gianluigi,
    Thanks for your reply.  However, i did try to rename the .srf file to .xml file and change the path to the following
         <b><specific image=".\test3.jpg" /></b>
    But the program didn't work.  But if i change it to <b><specific image="c:\test3.jpg" /></b>, give it the exact path then the program work again.
    Do you have any idea on it?
    Anna

  • How to i add an image path with spry data set

    hi
    how to i add an image path with spry data set. I made a xml file and then created a data set in html but image won't load
    this is my XML
    <?xml version="1.0" encoding="UTF-8"?>
    <banner width = "185" height = "400">
        <item>
            <image scr = "nui-panforte-recipe_01.jpg" ></image>
            <description>CHOC-COCONUT PANFORTE</description>      
            <text1>Try this delicious GLUTEN FREE Christmas treat</text1>
            <text2>CHOC-COCONUT PANFORTE</text2>
        </item>
    </banner>
    this is my HTML
    <!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" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script src="../../SpryAssets/xpath.js" type="text/javascript"></script>
    <script src="../../SpryAssets/SpryData.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    var ds1 = new Spry.Data.XMLDataSet("recipe_banner.xml", "banner/item");
    //-->
    </script>
    </head>
    <body>
    <div spry:region="ds1">
      <table>
        <tr spry:repeat="ds1">
          <td>{image}</td>
          <td>{description}</td>
          <td>{text1}</td>
          <td>{text2}</td>
          <td>{text3}</td>
          <td>{text4}</td>
          <td>{link}</td>
          <td>{url}</td>
          <td>{target}</td>
        </tr>
      </table>
    </div>
    </body>
    </html>

    It would be helpfull if you actually created an <img> tag to start with
    <img src="{image/@src}" />
    would work.

  • Set Database path dynamically

    Post Author: santoshk
    CA Forum: Data Connectivity and SQL
    Hi All,
    I am using asp dot net 2.0 With craystalreport and C#.
    While crating report i am giving server,databsename and all the credentials as per my computer. My crystal reports work fine.
    But problem occurs when i try to run the crystalreport other than my machine. It always ask for databse password,server name.
    Is it possible to set database path dynamically for sql server.
    Please help me.
    If anybody give me the detail procedure in c# ,it will be appriciated.
    Waiting for reply.
    thanks in advance

    Post Author: DLO34
    CA Forum: Data Connectivity and SQL
    I recently came across this issue. I was able to get a
    Crystal Report to work dynamically under limited conditions. If you create a
    direct connect report for an Oracle database then, it will only connect to
    other Oracle databases. The same is true for MSSQL and Sybase. When using the
    CRPE or RDC API you must set the logon credentials for the report as a whole
    and for each object within the report. Below is a snippet of my code C++ using
    the RDC API. This should help get you going.
    IReportPtr pReport;
    IDatabaseTablesPtr pTables
    IDatabaseTablePtr  pTable
    Int num_tables, i;
    // set for whole report
    pReport->Database->LogOnServer(DB_DLL, DB_Server_Name, DB_Name,
    DB_User_Name, DB_Password);
    pTables    = pReport->Database->GetTables();
    num_tables = pReport->Database->Tables->Count;
    for (i = 1; i <= num_tables; i++)
        pTable = pTables->GetItem(i);
        pTable->SetLogOnInfo(DB_DLL, DB_Server_Name, DB_Name,
    DB_User_Name, DB_Password);   // set for each object

  • Set Image URI dynamically

    Gurus,
    How can i set Image URI dynamically in code, based on some condtion.
    Kranthi

    Hi
    use the given below code in extended controller.
    OAImageBean dots =
    (OAImageBean)createWebBean(pageContext, OAWebBeanConstants.IMAGE_BEAN, null,
    "dotsImage");
    dots.setSource(OAWebBeanConstants.APPS_MEDIA_DIRECTORY + "cc_dotsprocess.gif");
    dots.setShortDesc(pageContext.getMessage("FND","FND_DOTS_SHORT_DESC"));
    // here u can try if block for different conditions
    dots.setDestination("give the url);
    dots.setHeight("35");
    dots.setWidth("8");
    webBean.addIndexedChild(dots);
    Thanks
    Pratap

  • Programatically set ole object image path

    Hi to all,
    I'm using Visual Studio 2005, Asp.net 2.0-C# and CR 11 Sp2.
    In my rpt file i added one ole object as bitmap i want to pass the data(image path) to this bitmap by programtically how to do this? Experts please help me

    Hello, Winseelan;
    If you are using Crystal Reports XI R2 (11.5) SP2 or later you can do this programatically using the 'Graphic Location' conditional formula.
    To do this, perform the following steps:
    1. Open the report in the Crystal Reports Designer.
    2. Create a formula called "Location" that contains a temporary path string to an image file. For example, "C:\Images\Image1.jpg".
    3. Right-click the image on the report and click 'Format Graphic'. The 'Format Editor' dialog box appears.
    4. In the 'Picture' tab, click the 'Graphic Location' conditional formula button. The Format Formula Editor appears.
    5. Call the "Location" formula from this conditional formula.
    6. Save changes to the report.
    7. In your application, you can now change the location of the image file at run time, by modifying the text in the "Location" formula programmatically using the following code:
    myReport.DataDefinition.FormulaFields.Item("Location").Text = "C:\Images\Image2.jpg"
    You can now view the image successfully when previewing your report in the application.
    Elaine

  • Handling dynamically generated Images

    Hello,
    I have a WDJ application that generates Images dynamically based on certain criterion. The dynamically generated images are put to the server using the code
      BufferedImage image = <rendered image ...>
      File outFile = new File( "Output.jpg") ;
      ImageIO.write( image, "jpg", outFile);
      /** Resource path is not set during the file creation 
       * as ImageIO throws IllegalArgumentException
    It gets saved to the folder <i><drive>\usr\sap\<SID>\JC<InstNo>\j2ee\cluster\server0\output.jpg </i> by default.
    Now, how to show up this dynamically generated image in a Image UI element? I have tried setting the output file name to the attribute that is bound to the "Source" property of the Image UI element but it doosn't show up as WD runtime is doing a look-up in the folder <i>../../../resources/com.test/<projectName>/Components/com.test.<componentName>/</i>
    Any pointers in this regard are highly appreciated.
    Bala

    Hi
    Try this
    Create the alias for the folder (C:\usr\sap\P13\JC00\j2ee\cluster\server0.)
    1.Goto Visual Administrator->Http Provider->Aliases in the Runtime Tab.
    2.Give the Alias Name and Path for the Folder.
    3.The Image sorce like http://<Server>:<Port>/<Alias>/<image>.<ext>
    Kind Regards
    Mukesh

  • LinkListExplorer iview BackGround Image path not working

    HI All ,
    As i am using Layout set LinkListExplorer for few external links , when i am giving image name for eg growth.jpg in  background image path,  which is placed at /etc/public/mimes/images it is not showing anything , the same is working for NewsBrowser Layout set  . I have tried many thing all possiblities but no success .
    Pls help me in this regard.
    Shwetang saxena

    Hi Vedant,
    APEX only replaces the #WORKSPACE_IMAGES# variable within APEX itself. This is quite logical, because what you see in the APEX developer space is generated by PL/SQL from the database, so APEX can change what it wants. APEX can't access the files however, that's logical to because APEX would need premissions on the server and an Oracle directoryto start doing changes to files.
    So if you want to point to the image directory in the CSS file you need to provide the full path.
    Regards,
    Joni

  • Image path in HTML output

    Hi all,
    I'm trying to deliver a BI report using the ftp device.
    The report is delivered in HTML format correctly, but
    when I try to open it, images that should display charts
    are not visible.
    Giving a look at the HTML code I've noticed that the image
    source path is:
    <img src="/xmlpserver/xdo/tmp/xdoimgZA4ql3v7Hz31567.gif">
    which is not the correct path.
    Is there a way to automatically set that path when the
    report is delivered?
    Thank you in advance,
    Roberto

    If you were to output the same report as PDF instead of HTML, I'm guessing the PDF file would contain the actual image. (Am I right anyone?) However, when you output as HTML, there is no way to embed an image in the HTML output.
    HTML can only reference external images via URLs, so it appears from your output HTML code that BI Publisher creates a temporary GIF image and allows it to be referenced via that unique URL. Who knows how long that URL is valid?
    After you FTP the output to another server, the <img src> reference is no longer valid, because the path in the src attribute is relative to the HTML file itself. The FTP'd report might show the image if you edit the HTML file so the src attribute includes the full URL to the image:
    <img src="http://bi.publisher.host:port/xmlpserver/xdo/tmp/xdoimgZA4ql3v7Hz31567.gif"/>
    But again, how long does BI Publisher cache the image, and how long until the login session times out so you can no longer access it anyway? Note that you would have to use the same browser session to view the FTP'd report as was used to run the report in the first place. In other words, run the BIP report initially using a browser on the host that is the FTP destination for the report. Then edit the <img> tag, and finally open the HTML file in the same browser.
    A note to other readers: Images in RTF templates are often used as mere placeholders for charts created when the report is run. It is the "Alternate Text" assigned to the dummy image that tells the XSL-FO processor how to replace the image with a chart displaying the report output data.
    To solve this problem in a more supportable way, please see this Tim Dexter blog entry:
    http://blogs.oracle.com/xmlpublisher/2006/10/31/
    Edited by: Multiverse on Aug 15, 2009 7:59 PM (added Tim Dexter blog reference)

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

Maybe you are looking for

  • How do I get bookmarks to display on left side of screen

    I would like to get the bookmark section back on the left side of the screen which is a much more convenient spot for my application. It appears mozilla has discontinued this, why? The bookmark saving is cumbersome at best. It makes no sense to remov

  • Check in Later option in edit locally

    Hi, We are in EP NW04s SP10. When i tried to Edit locally the documents in the KM repository , I am not getting the Check in Later option. I can see only Check In and Cancel Check out button. And in the Recent Notification iview , I am not getting th

  • Number for country + phone number

    I am not sure I entered the correct "number for country' when I opened my account. Also, I used my phone number. Should I have entered the number of my ipad? Please answer asap. thank you.

  • Create Custom TRADACOM Messages/Versions

    Hello Experts, I see options to edit messages for ANSI X12 and EDIFACT standards. But, I don't see an option to Edit and Create Custom messages or versions for TRADACOMS. Is it not possible to create custom messages/versions for TRADACOMS Thanks. Reg

  • From Vendor Creation to Payment of Supplier (New User Here)

    Hi, Can anyone here could help me find a link or any softcopy of document that will help me learn more about the process of vendor creation up to the payment of supplier process. Right now I'm using an Oracle Dev module so we can tests for ourselves