logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache, Coldfusion and CFFILE upload
Author
mliechty



Joined: 05 Sep 2014
Posts: 2
Location: USA, Logan Utah

PostPosted: Fri 05 Sep '14 18:52    Post subject: Apache, Coldfusion and CFFILE upload Reply with quote

I am the web librarian for a public library and we have had a Coldfusion/IIS setup for our web page until recently when we had to migrate to Apache for our library catalog. I was excited for Apache as IIS does have it's limitations. We've had everything up and working great for a while now but this week, I need to set up a form so our patrons can upload an image for a contest.

With IIS/Coldfusion, I used enctype="multipart/form-data" on the form page and on the action page I used cffile action="upload" to a folder not under the document root.

This set up isn't working under Apache. All I get when I try to upload an image is a blank screen. There is no error. The error log shows no error and the regular log has a 500 error for the page. When I remove the enctype and the cffile the rest of my form posts to the database just fine so I'm thinking that Apache isn't allowing the file upload.

At this point I am totally frustrated, I've looked at the web-dav module and adding that module doesn't seem to make a difference (maybe I haven't set it up correctly). What am I missing here?

Any help will be greatly appreciated.

I am running Apache 2.2, Coldfusion 9 on a Windows 2008 server.

Thanks for your help
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 10 Sep '14 11:21    Post subject: Reply with quote

Well a short upload tester

Code:

Here is a simple example (with absolutely no error handling).  You will just
need to change the directory/datasource/tablename values.

 <!---- page 1 --->
 <form action="yourActionPage.cfm" method="post" enctype="multipart/form-data">
 <input type="file" name="userFile">
 <input type="submit">
 </form>

 <!---- yourActionPage.cfm --->
 <!--- change the directory to your path --->
 <cffile action="upload" filefield="form.userFile"
destination="c:\yourFileDirectory">

 <!--- change datasource, table names etc...--->
 <cfquery name="storeFileName" datasource="#yourDSN#">
        INSERT INTO yourTable (FileName)
        VALUES ('#CFFILE.serverFileName#')
 </cfquery>

 <!--- display results --->
 <cfoutput>
        <b>File uploaded!: </b> #CFFILE.serverFileName#
 </cfoutput>


A log viewer http://jehiah.cz/a/coldfusion-error-log-viewer
Back to top
mliechty



Joined: 05 Sep 2014
Posts: 2
Location: USA, Logan Utah

PostPosted: Tue 16 Sep '14 18:43    Post subject: Reply with quote

Thanks for the code snippet. I get the same result using this snippet. All I get is a blank screen. If I remove "enctype="multipart/form-data"" the action page process with an error.

I think the problem is with Apache and the enctype. It doesn't seem to go any further than that.

Thanks again.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 16 Sep '14 18:54    Post subject: Reply with quote

What if you have the enctype, but not the input type file?
Back to top


Reply to topic   Topic: Apache, Coldfusion and CFFILE upload View previous topic :: View next topic
Post new topic   Forum Index -> Apache