macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: encrypt type on upload

Subject: Re: encrypt type on upload
From:
Date: Wed, 08 Aug 2007 07:43:47 -0700
Newsgroups: macromedia.coldfusion.cfml_general_discussion
On 8 Aug, 15:41, [email protected] wrote:
> On 8 Aug, 04:20, "myTeek" <[email protected]> wrote:
>
> > Hi all!  I'm uploading a file to the server while storing it's name in teh
> > database.  I believe I have that code covered, but here's the issue.  I keep
> > getting this error:
>
> >  Invalid content type: ''.
> >  The cffile action="upload" requires forms to use
> > enctype="multipart/form-data".
>
> >  But I do use the encrypt type ( <form
> > action="<cfoutput>#CurrentPage#</cfoutput>" method="POST"
> > enctype="multipart/form-data" name="uploadDoc">)
>
> >  So what's the catch?  I've seen someone else saying that maybe this was a 
> > bug?
> >  Has anyone found a way around this?
>
> Here is a sample upload page:
> <cfif isDefined("form.localFile")>
>         <cfset dirName = getDirectoryFromPath(getBasetemplatePath()) />
>         <cffile action="upload" destination="#dirName#" filefield="localFile"
>
> </cfif>
>
> <html>
> <body>
> <form method="post" enctype="multipart/form-data">
>          <INPUT TYPE="FILE" NAME="localFile" VALUE="localFile" />
>          <input type="submit" value="Upload" />
> </form>
> </body>
> </html>
>
> See if yours is different. BTW: you do not need to specify action if
> you submit form to itself...

One of the > signs got lost, here it is again:
<cfif isDefined("form.localFile")>
        <cfset dirName = getDirectoryFromPath(getBasetemplatePath()) />
        <cffile action="upload" destination="#dirName#"
filefield="localFile" />
</cfif>

<html>
<body>
<form method="post" enctype="multipart/form-data">
         <INPUT TYPE="FILE" NAME="localFile" VALUE="localFile" />
         <input type="submit" value="Upload" />
</form>
</body>
</html>


<Prev in Thread] Current Thread [Next in Thread>