Error uploading images and trying to update Access

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

gregoryrsmithAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrichmonCommented:
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
gregoryrsmithAuthor Commented:
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
mrichmonCommented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

gregoryrsmithAuthor Commented:
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
mrichmonCommented:
Instead of
<cfset picName = "form.pic" & #i#>
<cfset folderName = "form.folder" & #i#>

try

<cfset pcName = Form["pic" & i]>
<cfset folderName = Form["folder" & i]>
0
Tacobell777Commented:
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
Tacobell777Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.