>From: Michael Hodgdon [mailto:[EMAIL PROTECTED]
>Sent: Monday, October 20, 2003 16:24
>To: CF-Talk
>Subject: problem with file uploads on a MAC
>
>I was hoping I could get some help on the list. Sort of at a loss for this
>one. I am aware there are know issues with the MAC and IE doing for
>uploads. I have two upload boxes on a page. The first is required and the
>second is optional. If a user selects both upload options, my code runs
>through fine. However, because of the temp file issue with MACS, if the
>user does not select a file for the second option, code errors out because
>it tries an upload.
I came across this a while ago when implementing some code to automatically
TRIM *all* form fields coming in. The code I have is:
<cfscript>
if (IsDefined("form.fieldnames")) {
formFields = StructKeyArray(form);
for (i=1; i LTE ArrayLen(formFields); i=i+1) {
field = formFields[i];
IEMac = (FindNoCase("msie", CGI.HTTP_USER_AGENT)
AND FindNoCase("mac", CGI.HTTP_USER_AGENT));
if (NOT (ListFind("filePath,imagePath", field) AND
NOT IEMac)) {
StructUpdate(form, field, Trim(form[field]));
}
}
}
</cfscript>
The tag's comments say:
"Trims all form fields automatically (to avoid having to remember later),
but *doesn't* trim file upload fields for anything *but* IE/Mac (this
browser needs to have uploads trimmed; everything else breaks if trimmed)."
You'd have to adjust that ListFind() to accomodate whatever naming
conventions you have for file upload fields.
I'm referring to this code almost as if it's someone else's because I'm
currently totally baffled by it not working in our new framework. So I
can't completely vouch for it. BUT, it's been working OK in our other
sites, so more than likely there's an issue with something in our new
framework rather than this technique per se.
HTH,
Gyrus
[EMAIL PROTECTED]
http://norlonto.net/gyrus/dev/
PGP key available
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

