August 15th, 2011, 11:49 AM
Cffileupload errors (401)
I'm trying to use CF9's new cffileupload tag and allow multiple file uploading. However, it is not working as planned due to what seems to be a permissions error. We have created a generic user for the coldfusion service and applied this to the CF temp directory as well as the final destination directory. This setup seems to work 80% of the time in IE (I found one scenario to make it fail) and not at all in Chrome (gives the 401 error).
For simplistic reasons, the main page has:
The fileupload page has:
<cffileupload url="http://<mydomain>/fileupload.cfm" name="attachments" align="center" maxuploadsize="30" title="Attachments" height="200" width="600" bgcolor="DCDCDC" />
Obviously, <mydomain> and \\<server>\<folder> are filled in with the necessary information for my setup
<cffile action="upload" destination="\\<server>\<folder>\" nameconflict="makeunique" />
Any ideas that I may be missing on getting this to work properly?
August 15th, 2011, 12:38 PM
I don't see anything wrong, so it definitely looks like a permissions issue on either the fileupload.cfm or the destination used for the actual cffile. You might check the web server and OS logs on the servers to see if you can identify any pattern.
August 15th, 2011, 12:40 PM
August 15th, 2011, 02:18 PM
I appreciate the help. I have already went through that link so much that my head hurts and I still couldn't get anything to work properly.
Also, as I mentioned in my original post, we went in and added the generic user that the CF service uses and made sure it had proper permission on BOTH the destination directory as well as the CF temp directory that cffile uses when it uploads. This fixed the original 401 error that we got in IE, but it doesn't help one bit for chrome. No clue where to turn next...
August 15th, 2011, 03:08 PM
Are you passing the session ID in the file upload URL (as shown on Ray's blog)?
If it works in IE but not in Chrome then it still sounds like an NTLM problem, since IE can use it but non-MS browsers can't. My only advice at that point is to run it by a system admin who fully understands the server setups, your permissions/Active Directory policies, etc.
August 16th, 2011, 07:47 AM
I have tried both with and without the session ID and neither seem to work for Chrome.
That's one of the problems we have here. People on the server side only THINK they know what is going on and we are not allowed to do their jobs. I'd be willing to bet something is set up wrong and they don't even realize. Seems like it would be something dumb at this point..
I guess from here, what exactly is the differences on how the browsers interact with the server? Meaning, why would it work in IE and not Chrome? Is it just an inherited understanding of security being both MS products or is it something more?
August 16th, 2011, 10:09 AM
There are many subtle differences between the browsers, but the main one I'm thinking of is that NTLM authentication is a Windows-only authentication scheme. So most of the other browsers either don't support it, partially try to support it, or may have issues with supporting it.
Does it work in Firefox or Safari? Also, is it the latest version of Chrome?
August 16th, 2011, 10:40 AM
Yes Chrome is the latest version and no it does not seem to work in any other browser other than IE.
What I do not understand is how cffile works just fine until used in conjunction with cffileuploader for multiple uploads. Baffles me.
August 16th, 2011, 10:53 AM
I'm honestly not sure, but I've never had to use it in a situation where the files were being saved on a separate server.
Does it work all right if you change the code to save the files to a temp directory ON the CF server? That would tell you if the problem is in the move of the files from the CF box to the other machine.
August 16th, 2011, 02:05 PM
No it does not. I tried uploading to a folder in my website that is on the same server as well as just uploading to the getTempDirectory() path. All still gives the same 401 error.
August 16th, 2011, 05:36 PM
In that case, if it works when saving the files on the same server with IE, but does not in Chrome, then it must be some sort of permissions or authentication issue.
August 17th, 2011, 08:03 AM
Yes that is what I thought it was from the beginning hence the 401 errors. However, we have a generic user on the network set up for the CF service and have that set up with full permissions where needed and it still doesn't work anywhere but in IE. Wasn't sure if there was more to it or a different user that it tries to use etc.
August 17th, 2011, 08:25 AM
The thing that gets me is if I create a basic form with the enctype set and do a single file input and send that to the SAME cffile upload page it works just fine from everywhere.
That being said, what is so different from that and cffileupload as far as permissions go? Is it because of the flash?
August 17th, 2011, 10:23 AM
Did you try passing the session/jsessionid (as Ray discussed in the blog entry I sent earlier)?
There really shouldn't be any difference between Flash and an HTML form, since both should just be doing HTTP POSTS under the hood. Nor can I think of a reason why IE would do something special that the other browsers don't do...
August 17th, 2011, 10:53 AM
Yes i tried passing the sessionids across and no luck. I even tried to see what they were ON the upload page and I couldn't get that to run either. Appending to a log file, cfmail myself, nothing. I'm just going to give in and make the users upload 1 file at a time so I know it works. Lucky for this instance they never upload more than 2-3 at a time anyway so it's not a big deal.
If you ever have an epiphany moment and realize something we forgot or anything I guess let me know. Thanks.