Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default problem about pics

    Hey people,im new (about 6 months) in this coldfusion stuff, im interested in
    this ?technology? so im doing my own personal site,but i have problems so....
    can someone help me??

    Its about coldfusion, and the problem is how can i store an image(regardless
    of the format)in a database? For example i understand how to get users data and
    store it in a database. But when i want to store just a pic from a form,and an
    input type=?file? the form receive the path to store that pic in my
    server(c:\myweb\pics....)and not the name of the file.I was reading about this
    and i know that the cffile.serverfile (that represent the name of the file)
    variable is created after the operation, but i dont imaging how to store the
    name in the database. ?Or how can i store a series of images(that are stored in
    my server-pc in a folder) in a database?

    I was reading that i can convert a binary file(the image) to base64(i
    understand the concept)... i did it and i get something like
    this(/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAcEBAQFBAcFBQcKBwUH............)but i
    wanted to store (manually) to a table in access but i couldnt because the
    base64 is tooooo long to store it :(

    I was reading the coldfusion documentation and some other books, and
    sincerely im spending mucht time just to do this(and other stuff like a message
    board like this site and i dont wanna give up :) ) please someone help me



    And the action page?? Well, i couldnt do it well and got http 500 error, so i
    didnt included it, i know that in the action page should be a cffile tag....

    aaah, sorry, i couldnt atach code, it didnt work

    jaciel2005 Guest

  2. Similar Questions and Discussions

    1. Pics
      Hey I've only just recently started using flash so im not that aware of what it can do!! I want to have the front page of my site to have a few...
    2. Help me!! problem with loading pics
      Hi, I got a problem with loading pics... I read a directory in a textfield. Every line is another image name. When I get to the place where I first...
    3. Why are my pics so grainy?
      I've been trying to do a lot of concert photography lately. I use a Nikon N65 with a Sigma 28-80mm lense with 800 film. A lot of my phots turn out...
    4. pics from pentax SMC 75-150 M f4 ANYONE?
      Does anyone have pics taken with an pentax SMC 75-150 M f4 lens that you'd be willing to show me via a link or e-mail or something? I'm trying to...
    5. new pics please look
      "wayne" <adfoto@datafast.net.au> wrote in message news:3f16984d@usenet.per.paradox.net.au... Contrast is a little too stark for my tastes. Lost...
  3. #2

    Default Re: problem about pics

    Just as a reminder - storing images in the DB isn't always the most
    performance-wise option. For every image download, you'd have to do a binary
    transaction from the DB.

    If you want to protect your files so that others can't see the URLs of the
    images, i.e. build some kind of security system, I recommend placing the images
    outside the web root, and serving them using <CFCONTENT> (although that's also
    somewhat consuming for ColdFusion, I think, but sometimes the only option).

    Aaaanyway, I've never inserted an image into DB, but in theory it's easy.
    You submit a form, right? a <CFFILE action="upload" ....> will receive the
    file, after which the #cffile.serverfile# variable contains the file name. By
    this, you should already know in which directory the file was uploaded, since
    you define that in the upload phase.

    After uploading, you read the file with <CFFILE action="readBinary".....> into
    a variable (object, rather), and then you should be able to use <CFQUERY> and
    <CFQUERYPARAM> to insert the image variable into a column (type BLOB or
    similar).

    Check out [url]http://www.forta.com/[/url] blog for how to serve images from the DB.


    Fernis Guest

  4. #3

    Default Re: problem about pics

    Why don't you store only the path to the image on the db. If you know where the
    image will be stored you can populate the db with the image path and grab the
    image name and extension from the form entry.

    webCFDev Guest

  5. #4

    Default Re: problem about pics

    C:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp2090.
    tmp ???This path appears in my access DB instead of c:\myserver\etc...
    even if the destination attribute is c:\myserver\etc... the pic was stored in
    the right folder, and users data was stored correctly except path to that
    pic..grrrrr :@

    the cffile.serverfile is created, right? well i tried to store this variable
    whit a cfquery but it appears an error "string index out of range: -1"

    jaciel2005 Guest

  6. #5

    Default Re: problem about pics

    just use file.serverfile (after CFFILE) to get the filename to put in your database
    J?J Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139