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

cffileupload not actually uploading anything

Contributor ,
Jan 11, 2010 Jan 11, 2010

I am using a simple example trying to start experimenting with the multiple file upload feature in CF 9. However it acts like it uploads, gives no sort of error I can see, yet it actually uploads nothing to the server. Am i missing something obvious?

Uploading page code.

  <cffileupload
    align="center"
    url="uploadFiles.cfm"
    width=600/>

Code for the uploadFiles.cfm page.

<cffile action="upload" destination="c:\temp" nameconflict="makeunique" />

Pretty simple code yet it doesn't seem to work. I know I can use cffile to write to the directory as I have tested that seperately. Any ideas out there?

TOPICS
Advanced techniques
5.9K
Translate
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

correct answers 1 Correct answer

LEGEND , Jan 12, 2010 Jan 12, 2010

Is there any chance an Application.cfm / .cfc is doing [something] that is getting in the road here?  Can you remove all doubt by sticking a blank Application.cfm in the same dir as your test code?

I'm pretty much out of sensible things to suggest, so looking at some less sensible ones.

What version of Flash Player are you running?  Have you tested this on various different browsers, in case your FP install is bung on the one you're testing with?

--

Adam

Message was edited by: A Cameron

Translate
Community Expert ,
Jan 12, 2010 Jan 12, 2010
@Hedge
So the question is why would this stop the code from working?

What about the obvious? Either one or both of the cookies is nonexistent, or validation fails.

One can see cffileupload as performing one or more form-like submissions. Then, your Application file will do a cookie check each time, and abort accordingly. You could improve the validation code as follows.

<cflogin>

<CFIF IsDefined("COOKIE.Password") AND IsDefined("COOKIE.Email")>
    <!--- validate the information in the cookies --->
    <CFQUERY DATASOURCE="#APPLICATION.DSN#" NAME="GetAdminAccount">
        SELECT * FROM APass
        WHERE Email = <cfqueryparam value="#COOKIE.Email#" cfsqltype="CF_SQL_VARCHAR" maxlength="150"> AND
        Password = <cfqueryparam value="#COOKIE.Password#" cfsqltype="CF_SQL_VARCHAR" maxlength="50">
    </CFQUERY>
    <!--- if validation fails send them back to the login --->
    <CFIF GetAdminAccount.RecordCount GT 0>

        <cfloginuser name = "#COOKIE.Email#" password = "#COOKIE.Password#" roles = "them_roles">

    <CFELSE>
        <CFINCLUDE TEMPLATE="index.cfm">
        <CFABORT>
    </CFIF>
<CFELSE>
        <CFINCLUDE TEMPLATE="index.cfm">
        <CFABORT>
</CFIF>

</cflogin>

I assume you also set cfapplication's loginStorage to "cookie". The default value, that is, if you leave out the loginStorage attribute, is also "cookie". The key to this construction is that the code within the cflogin tag wont run once the user has successfully logged in.

[Added later: To test this hypothesis, add the line

<cfcookie expires="1" name="index_cfm_cookie" value="index_cfm_cookieValue #now()#">

to the index.cfm page


Attempt an upload using your original -- unsucccessful -- code. Then do <cfdump var="#cookie#"> on some arbitrary page.

See the cookie? If so, then the upload mission was aborted at some point.]

Translate
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