Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error uploading images and trying to update Access

Posted on 2004-10-31
7
Medium Priority
?
164 Views
Last Modified: 2013-12-24
Hi,

I'm trying to build a back end to a photo gallery where I can upload images and update my dayabase to reflect the new titles. I think I've painted myself into a corner and am stuck, could use some help. Thank You.

The first page uploads the titles and works.

<cfquery name="getNewName" datasource="shalmy2">
SELECT *
FROM titles
WHERE num = #FORM.selectNumber#
</cfquery>

<cfoutput query="getNewName">
  <cfform action="scenes22.cfm" method="post" name="form1" enablecab="yes">
    <input name="number" type="hidden" value="#num#">
    <input name="newTitle" type="text" value="#title#" size="50" required="no">
    <br>
      <textarea name="newComments" rows="3" cols="80">#comments#</textarea>
    <br>
    <div align="center">
      <input name="submit" type="submit" value="Update Title">
    </div>
  </cfform>
</cfoutput>

This page updates the title and comments, deletes the previous image names and gets a form ready for uploading the actual photos

<cfquery datasource="shalmy2">
UPDATE titles
SET title = '#FORM.newTitle#',
    comments = '#FORM.newComments#'
WHERE num = #FORM.number#
</cfquery>

<cfquery datasource="shalmy2">
UPDATE imageNames
SET imageName = NULL
WHERE folderNum = #FORM.number#
</cfquery>

<cfquery name="uploadThumbs" datasource="shalmy2">
SELECT *
FROM imageNames
WHERE folderNum = #FORM.number#
</cfquery>

   <form action="scenes25.cfm" enctype="multipart/form-data" method="post">

            <cfoutput query="uploadThumbs">      
      <input name="folder#num#" type="hidden" value="#newFolderNum#">      
      <input name="pic#num#" type="file" size="25">
             </cfoutput>

            
  <div align="center">
    <input type="Submit" name="upload" value="upload">
  </div>
</form>

Here's where I have the trouble. This page is supposed to load the photos and update Access. I don't know if the action page will even upload the photos, CF won't let me get past the WHERE clause in the query.

<cfloop FROM= "1" TO= "10" index="i">
<cfset picName = "form.pic" & #i#>
<cfset folderName = "form.folder" & #i#>
<cfquery name="#i#" datasource="shalmy2">
UPDATE imageNames
SET imageName = '#picName#'
WHERE folderNum = '#folderName#' AND num = #i#
</cfquery>
</cfloop>



    <cfloop index="i" from="1" to="10" step="1">
      <cfset filename = "form.pic" & #i#>
      <cfif evaluate(variables.filename) neq "">

        <cffile action="UPLOAD"
                 destination="C:\CFusionMX\wwwroot\experiments\thumbs\"
           nameconflict="OVERWRITE"
           filefield="#variables.filename#">

        <cfset message = message & ",File%20#i#%20(#file.serverfile#)%20was%20uploaded">
      <cfelse>
        <cfset message = message & ",File%20#i#%20was%20empty">
      </cfif>
    </cfloop>

Thanks,
Greg Smith

0
Comment
Question by:gregoryrsmith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 12464769
Personally I would NOT upload the images into Access.  You will end up with a very very very slow website and a huge databse.

What I would do is upload the files to a directory on your webserver and then store the path in the access database as a text field.

Then you simply display by:

<img src="#imagePath#">
0
 

Author Comment

by:gregoryrsmith
ID: 12466644
The question was poorly titled.

I'm trying to upload photos to the server using cffile and at the same time,  I'm trying to update image names into Access

Evereything works well until the last page CF has a problem wiht the WHERE clause
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12467418
What is the error?

UPDATE imageNames
SET imageName = '#picName#'
WHERE folderNum = '#folderName#' AND num = #i#

does not seem to have a problem unless the fact that folderNum is a number and '#folderName#' is a string?
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

Author Comment

by:gregoryrsmith
ID: 12468995
Now the last page gives me HTTP error 500, and tthis is loaded into the database where the image name should be C:\CFusionMX\runtime\servers\default\SERVER-INF\te
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 1200 total points
ID: 12469691
Instead of
<cfset picName = "form.pic" & #i#>
<cfset folderName = "form.folder" & #i#>

try

<cfset pcName = Form["pic" & i]>
<cfset folderName = Form["folder" & i]>
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 12470061
what is the size of the field in the database? Maybe its to small and cuts of the path? C:\CFusionMX\runtime\servers\default\SERVER-INF\te


Also, go into your browser, tools, internet options, advanced, untick "show friendly error messages"
then visit your page again and paste error here.
0
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 200 total points
ID: 12470064
also

<cffile action="UPLOAD"
               destination="C:\CFusionMX\wwwroot\experiments\thumbs\"
           nameconflict="OVERWRITE"
           filefield="#variables.filename#">

Should be

<cffile action="UPLOAD"
               destination="C:\CFusionMX\wwwroot\experiments\thumbs\"
           nameconflict="OVERWRITE"
           filefield="filename">

just the name of the form field
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question