Ask a Question related to Coldfusion Flash Integration, Design and Development.

  1. #1

    Default Uploading image

    I'm got a cool uploading images tutorial from Asfusion.com. I got it working
    but this is my issue. I created a db table called "photos", in the photos
    table I made two columns named "id" and "images". I'm allowing users to login
    and upload images to a folder on my server. I now want to save the name of the
    image that was uploaded, to my db column named "images" aswell as save the user
    id to my "id" column. I'm using SESSION.Auth.id .

    I'm using a tabbed cfform to do this, what I'm trying to make happen is on one
    tab is the upload field and upload button, on the second tab I want to bind the
    images that was upload by a specifc user (called by the id) to a cfgrid and
    display all the images uploaded by that user. So I want to associate all the
    images of a specific user to there user id.

    How do I send the users id through the query string to get saved to my db
    table called photos?

    If my code is incorrect, can someone lead me in the right direction? Or is
    there an easier way to get what I nreed to get done?

    Thanks
    Rob


    This is the upload code:

    <cf_flashUpload label="Picture:" name="myfile2" fileTypes="*.jpg;*.png;*.gif"
    fileDescription="Image files" actionFile="upload.cfm" maxSize="500">


    <cf_flashUploadInput buttonStyle="corner-radius: 10;"
    inputStyle="fontWeight:bold" inputWidth="190" uploadButton="true"
    uploadButtonLabel="Upload" chooseButtonLabel="Choose file" progressBar="true"
    progressInfo="true" required="yes" message="Please enter a valid file to
    upload!" />
    </cf_flashUpload>

    This is the processing script:

    <cfif structkeyexists(form,"Filedata")>
    <cffile action="UPLOAD" filefield="FileData"
    destination="#expandpath("\uploads")#" nameconflict="MAKEUNIQUE">
    </cfif>


    <CFQUERY DATASOURCE="#DataSource#">
    INSERT into photos(images,id)
    VALUES('#Trim(FORM.myfile2)#',
    ('#Trim(URL.SESSION.Auth.id)#')
    </CFQUERY>


    infa Guest

  2. Similar Questions and Discussions

    1. Don't want an /image folder when uploading images
      I want to be able to upload image files from my local computer using Contribute CS3 without having the program create an IMAGES folder. I don't...
    2. uploading imageready image map
      hello, i'm pretty new to photoshop and have just made my first image map with rollovers using photoshop and imageready. when i preview it in the...
    3. Uploading image and text into a database
      Hi All, I would like to know if there is a way to upload an image and text into an Access database using asp. I have a web site hosted on a web...
    4. ObjectDisposedException after uploading image via Dime
      After I upload an image to my webservice using a dime attachment I receive ObjectDisposedException on any subsequent calls to any method on the web...
    5. Uploading an Image from a web page
      I am using the control type = file to perform a file upload. When I click on the browse button to go select the image I want to upload it places...
  3. #2

    Default Re: Uploading image

    Add a cfinput to your for name it whatever your db field is and use
    SESSION.Auth.id vaerable as the value. Then pass this over to the cfc via
    the remoting and insert it into your db.

    "infa" <webforumsuser@macromedia.com> wrote in message
    news:ee5e7v$mgk$1@forums.macromedia.com...
    > I'm got a cool uploading images tutorial from Asfusion.com. I got it
    > working
    > but this is my issue. I created a db table called "photos", in the photos
    > table I made two columns named "id" and "images". I'm allowing users to
    > login
    > and upload images to a folder on my server. I now want to save the name
    > of the
    > image that was uploaded, to my db column named "images" aswell as save the
    > user
    > id to my "id" column. I'm using SESSION.Auth.id .
    >
    > I'm using a tabbed cfform to do this, what I'm trying to make happen is on
    > one
    > tab is the upload field and upload button, on the second tab I want to
    > bind the
    > images that was upload by a specifc user (called by the id) to a cfgrid
    > and
    > display all the images uploaded by that user. So I want to associate all
    > the
    > images of a specific user to there user id.
    >
    > How do I send the users id through the query string to get saved to my db
    > table called photos?
    >
    > If my code is incorrect, can someone lead me in the right direction? Or is
    > there an easier way to get what I nreed to get done?
    >
    > Thanks
    > Rob
    >
    >
    > This is the upload code:
    >
    > <cf_flashUpload label="Picture:" name="myfile2"
    > fileTypes="*.jpg;*.png;*.gif"
    > fileDescription="Image files" actionFile="upload.cfm" maxSize="500">
    >
    >
    > <cf_flashUploadInput buttonStyle="corner-radius: 10;"
    > inputStyle="fontWeight:bold" inputWidth="190" uploadButton="true"
    > uploadButtonLabel="Upload" chooseButtonLabel="Choose file"
    > progressBar="true"
    > progressInfo="true" required="yes" message="Please enter a valid file to
    > upload!" />
    > </cf_flashUpload>
    >
    > This is the processing script:
    >
    > <cfif structkeyexists(form,"Filedata")>
    > <cffile action="UPLOAD" filefield="FileData"
    > destination="#expandpath("\uploads")#" nameconflict="MAKEUNIQUE">
    > </cfif>
    >
    >
    > <CFQUERY DATASOURCE="#DataSource#">
    > INSERT into photos(images,id)
    > VALUES('#Trim(FORM.myfile2)#',
    > ('#Trim(URL.SESSION.Auth.id)#')
    > </CFQUERY>
    >
    >

    Rick Guest

  4. #3

    Default Re: Uploading image

    Ok, I'm new to cf so if I understand you, this is what I should do:

    <cfinput
    type="Text"
    name="myimages" (This is the name of my image table)
    value="SESSION.Auth.id"
    size="20"
    maxlength="100">

    Now from here, do I ad this field above my upload field?
    And does the user enter their id into this field before they uploading?

    Could you perhaps write an example code of passing the value to the cfc.
    Again I'm new to cf, I understand what they are and how they work thanks ot Ben
    Forta's book, but I have not yet try to make one. this is the part of you
    message that has me puzzled:

    "Then pass this over to the cfc via
    the remoting and insert it into your db."

    Thanks a lot Rick for your help.

    Rob.

    infa 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