• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

File Upload utility functionality

New Here ,
Sep 11, 2008 Sep 11, 2008

Copy link to clipboard

Copied

I created a record keeping system where the user 3 uploads a files. When the user opens the system the second time to upload new files and perhaps only uploads 1 file the database records of the two other files are overwritten and not maintained. How do I correct this issue. The action page has been included.
TOPICS
Advanced techniques

Views

326

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 11, 2008 Sep 11, 2008

Copy link to clipboard

Copied

Tony Soto wrote:
> I created a record keeping system where the user 3 uploads a files. When the
> user opens the system the second time to upload new files and perhaps only
> uploads 1 file the database records of the two other files are overwritten and
> not maintained. How do I correct this issue. The action page has been included.
...
> Attachm1='#Trim(Form.Attachment_1)#',
> Attachm2='#Trim(Form.Attachment_2)#',
> Attachm3='#Trim(Form.Attachment_3)#',
...

This section of your update SQL is writing to all three attachment
fields, even if the form fields are empty. The simplest solution is
probably to make this section dynamic so that the Attachment fields are
only updated if the form fields actually contain a valid value.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 11, 2008 Sep 11, 2008

Copy link to clipboard

Copied

Hi Ian,
thanks for the response. How do I go about make the SQL statement dynamic?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 11, 2008 Sep 11, 2008

Copy link to clipboard

Copied

LATEST
Tony Soto wrote:
> Hi Ian,
> thanks for the response. How do I go about make the SQL statement dynamic?

You include conditional code inside the <cfquery...> block that
dynamically builds the SQL. Which, from ColdFusion's point of view, is
just text. No different then HTML, XML or any other text that
ColdFusion is so good at dynamically building.

Example:
<cfquery...>
....
<cfif this EQ that>
thisField = 'thatValue'>
</cfif>
...
</cfquery>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation