Skip to main content
Participant
May 22, 2011
Question

Need the code to insert into access db a URL address

  • May 22, 2011
  • 2 replies
  • 645 views

Hello,  Using coldfusion 9.01 and dreamweaver.    I have a problem with insert an image, thats not a problem, but i have the db set to text and Im putting the LINK to the Image address which   comes out this   way: D:\inetpub\wwwroot\directory\images\imagename.gif  , what I actually need is for it to input into the db the URL address or   ../images/imagename.gif      the area of the code is as follows              

                                                                     Photo                              The above lets you browse to the image and uploads its just fine but not in the format   that I need in the Access 2007 database.    Can someone give me a hand at what the code is to correctly do this.    thanks      Battle
    This topic has been closed for replies.

    2 replies

    Inspiring
    May 22, 2011

    Right, so basically you have a string like this:

    D:\inetpub\wwwroot\directory\images\imagename.gif

    And you need to transform that into a string like this:

    ../images/imagename.gif

    Is that basically what you're asking?

    If so, let's look at the requirement.  There seem to be three things you need to do here:

    * lop off the bit of the path that is above the webroot, eg: D:\inetpub\wwwroot\directory

    * switch the backslashes for forward slashes

    * prepend ".."

    Which bit is giving you a problem?

    --

    Adam

    BattleAuthor
    Participant
    May 22, 2011

    Well, I cant figure out how to post the code, it just erases that part so if someone will let the know how, i'll post it.  Battle

    Inspiring
    May 22, 2011

    Just trying to post code:

    <cfset foo = "bar">

    --

    Adam

    Inspiring
    May 22, 2011

    Works OK for me.  I just typed it in.

    --

    Adam