|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
CFFILE
I have a CFFILE question:Monique Boea 05/26/04 10:07 A It will upload one file at a time and not two or three togetherMonique Boea 05/26/04 10:09 A On May 26, 2004, at 10:06 AM, Monique Boea wrote:Damien McKenna 05/26/04 10:14 A Combing the three into one cffile with a loop?Monique Boea 05/26/04 10:23 A Can you post the code for the submission form?George Abraham 05/26/04 10:26 A <cftry>Monique Boea 05/26/04 10:29 A Ah sorry, I meant the code for the form page, not the action page. So theGeorge Abraham 05/26/04 10:35 A sorry, it's longMonique Boea 05/26/04 10:42 A Get rid of the cftry and cfcatch for now so you can see why the cffileGreg Luce 05/26/04 12:51 P On May 26, 2004, at 10:20 AM, Monique Boea wrote:Damien McKenna 05/26/04 10:32 A > From: Monique BoeaPhilip Arnold 05/26/04 11:03 A For the filefield attribute, you need the name of the <inputPascal Peters 05/26/04 10:51 A > The destination attribute has to be a directory (not a file!). You canBen Doom 05/26/04 12:47 P > Get rid of the cftry and cfcatch for now so you can see whyTangorre, Michael 05/26/04 01:34 P In my reference (cfmx):Pascal Peters 05/26/04 01:53 P > In my reference (cfmx):Ben Doom 05/26/04 02:23 P http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p35.htm#wp35Pascal Peters 05/26/04 02:27 P My CFFILE issue is resolved.Monique Boea 05/26/04 03:21 P > From: Monique BoeaPhilip Arnold 05/26/04 03:27 P YIKES!!Monique Boea 05/26/04 03:34 P yeah, you might want to to aTony Weeg 05/26/04 03:37 P > From: Tony WeegPhilip Arnold 05/26/04 03:42 P full-stops?Monique Boea 05/26/04 03:54 P image.name.jpegTony Weeg 05/26/04 04:08 P > From: Monique BoeaPhilip Arnold 05/26/04 04:50 P sure did :)Tony Weeg 05/26/04 04:07 P So what's the alternative?Monique Boea 05/26/04 03:39 P ACtually, there is Javascript on the previous page that forces a three digitMonique Boea 05/26/04 03:40 P On the action page make sure you are specifying three differentAdkins, Randy 05/26/04 03:48 P I think full stops are periods.Jerry Johnson 05/26/04 04:26 P so, the htought was that listLast() would get the files extension,Tony Weeg 05/26/04 04:29 P > From: Tony WeegPhilip Arnold 05/26/04 04:49 P I have a CFFILE question: I have a form which allows a user to upload three different images at the same time I have three different <cffile action="upload".... tags on the processing page. The problem is it only uploads the very first image... Any suggestions? It will upload one file at a time and not two or three together I have a CFFILE question: I have a form which allows a user to upload three different images at the same time I have three different <cffile action="upload".... tags on the processing page. The problem is it only uploads the very first image... Any suggestions? _____ On May 26, 2004, at 10:06 AM, Monique Boea wrote: > It will upload one file at a time and not two or three together Try doing a cfloop or cfoutput with "cffile" as the query name. I haven't tried it yet but it might work. -- Damien McKenna - Web Developer - dmckenna@thelimucompany.com The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 Combing the three into one cffile with a loop? On May 26, 2004, at 10:06 AM, Monique Boea wrote: > It will upload one file at a time and not two or three together Try doing a cfloop or cfoutput with "cffile" as the query name. I haven't tried it yet but it might work. -- Damien McKenna - Web Developer - dmckenna@thelimucompany.com The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 _____ Can you post the code for the submission form? George At 10:20 AM 5/26/2004, Monique Boea wrote: ----- Excess quoted text cut - see Original Post for more ----- <cftry> <!--- upload new file ---> <cffile action="upload" filefield="form.tLogoFilename" destination="#variables.home_dir#media\images\clientlogos\#variables.tLogoFi lename#" nameconflict="overwrite"> <cfcatch> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> alert("Error uploading Logo file. Please try again."); history.go(-1); </SCRIPT> <cfexit> </cfcatch> </cftry> There is one for each image (3) Can you post the code for the submission form? George At 10:20 AM 5/26/2004, Monique Boea wrote: ----- Excess quoted text cut - see Original Post for more ----- _____ Ah sorry, I meant the code for the form page, not the action page. So the page just before this one. George At 10:26 AM 5/26/2004, Monique Boea wrote: ----- Excess quoted text cut - see Original Post for more ----- sorry, it's long <form action="cobranding_proc.cfm" method="post" enctype="multipart/form-data" onsubmit="return validateform();"> <table width="600" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="100" align="left"> </td> <td width="500" align="right"> </td> </tr> <tr> <td><b>Label:</b></td> <td><cfoutput><input type="text" name="tScreenLabel" maxlength="100" size="50" value="#htmlEditFormat(variables.tScreenLabel)#"></cfoutput></td> </tr> <tr> <td><b>Logo:</b> </td> <td><cfoutput><input type="file" name="tLogoFilename" maxlength="50" size="50"></cfoutput></td> </tr> <tr> <td height="5" colspan="2"> </td> </tr> <tr><td></td> <td><b class="mep">Image size must be 187 X 62 (W x H) pixels </b> </td> </tr> <tr> <td height="10" colspan="2"> </td> </tr> <cfif variables.tLogoFilename is not ''> <tr> <td> <a href="cobranding_proc.cfm?action=delete&object=tLogoFilename">remove - ></a> </td> <td align="left"><cfoutput><img src="../media/images/clientlogos/#variables.tLogoFilename#"></cfoutput></td> </tr> </cfif> <tr> <td colspan="2"> </td> </tr> <tr> <td><b>Header Background Image:<br> </b></td> <td><cfoutput><input type="file" name="tHeaderBGFilename" maxlength="50" size="50"></cfoutput></td> </tr> <tr><td></td> <td><b class="mep">Image size must be 36 pixels high (MAX) </b> </td> </tr> <tr> <td height="10" colspan="2"> </td> </tr> <cfif variables.tHeaderBGFilename is not ''> <tr> <td> <a href="cobranding_proc.cfm?action=delete&object=tHeaderBGFilename">remove - ></a> </td> <td align="center" height="36"> <cfoutput> <table border="0" cellpadding="0" cellspacing="0" width="300"> <tr> <td width="5"><img src="../media/images/menu/#variables.tHeaderBGFilename#"></td> <td width="20" valign="middle" align="center"> = </td> <td width="*" background="../media/images/menu/#variables.tHeaderBGFilename#"> </td> </tr> </table> </cfoutput> </td> </tr> </cfif> <tr> <td height="20" colspan="2"> </td> </tr> <tr> <td colspan="2"><b>Header Color Code (EX: #12250P):</b> <cfoutput> <input type="text" name="tHeaderBGColor" value="#variables.tHeaderBGColor#" maxlength="50" size="10"></cfoutput> </td> </tr> <tr> <td colspan="3"><a href="javascript:Start('colorcodes.html')";>Click here to open color chooser.</a></td> </tr> <tr> <td height="20" colspan="2"> </td> </tr> <cfif variables.tHeaderBGColor is not ''> <tr> <td colspan="2" <cfoutput>bgcolor="#variables.tHeaderBGColor#"</cfoutput> width="10"> </td> </tr> </cfif> <tr> <td colspan="2"> </td> </tr> <tr> <td><b>Header Foreground Image:</b></td> <td><cfoutput><input type="file" name="tHeaderFGFilename" maxlength="50" size="50"></cfoutput></td> </tr> <tr><td></td> <td><b class="mep">Image size must be 36 pixels high (MAX) </b> </td> </tr> <tr> <td height="10" colspan="2"> </td> </tr> <cfif variables.tHeaderFGFilename is not ''> <tr> <td> <a href="cobranding_proc.cfm?action=delete&object=tHeaderFGFilename">remove - ></a> </td> <td align="center"><cfoutput><img src="../media/images/menu/#variables.tHeaderFGFilename#"></cfoutput></td> </tr> </cfif> <tr> <td colspan="2"> </td> </tr> <tr> <td>Link 1 Label:</td> <td><cfoutput><input type="text" name="tURL1label" maxlength="100" size="50" value="#htmlEditFormat(variables.tURL1Label)#"></cfoutput></td> </tr> <tr> <td>Link 1:</td> <td><cfoutput><input type="text" name="tURL1" maxlength="200" size="30" value="#htmlEditFormat(variables.tURL1)#"></cfoutput> <http://www.balser.com> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td>Link 2 Label:</td> <td><cfoutput><input type="text" name="tURL2label" maxlength="100" size="50" value="#htmlEditFormat(variables.tURL2Label)#"></cfoutput></td> </tr> <tr> <td>Link 2:</td> <td><cfoutput><input type="text" name="tURL2" maxlength="200" size="30" value="#htmlEditFormat(variables.tURL2)#"></cfoutput> <http://www.balser.com> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td>Link 3 Label:</td> <td><cfoutput><input type="text" name="tURL3Label" maxlength="100" size="50" value="#htmlEditFormat(variables.tURL3Label)#"></cfoutput></td> </tr> <tr> <td>Link:</td> <td><cfoutput><input type="text" name="tURL3" maxlength="200" size="30" value="#htmlEditFormat(variables.tURL3)#"></cfoutput>< <http://www.balser.com> td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2" align="center"> <br><br><input type="submit" value="Submit"> <input type="button" value="Cancel" onclick="javascript:parent.location.href='menu.cfm';"> <cfoutput> <input type="hidden" name="action" value="add_edit"> <input type="hidden" name="editflag" value="#variables.editflag#"> <input type="hidden" name="textension" value=""> <input type="hidden" name="tBGextension" value=""> <input type="hidden" name="tFGextension" value=""> </cfoutput> </td> </tr> </table> </form> Get rid of the cftry and cfcatch for now so you can see why the cffile operation isn't working. The CF error should tell you what's wrong. Greg <cftry> <!--- upload new file ---> <cffile action="upload" filefield="form.tLogoFilename" destination="#variables.home_dir#media\images\clientlogos\#variables.tLogoFi lename#" nameconflict="overwrite"> <cfcatch> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> alert("Error uploading Logo file. Please try again."); history.go(-1); </SCRIPT> <cfexit> </cfcatch> </cftry> There is one for each image (3) Can you post the code for the submission form? George At 10:20 AM 5/26/2004, Monique Boea wrote: ----- Excess quoted text cut - see Original Post for more ----- _____ On May 26, 2004, at 10:20 AM, Monique Boea wrote: > Combing the three into one cffile with a loop? That's what I'm thinking.. eg <cffile ....> <cfoutput query="cffile"> #cffile.clientFileName#<br /> </cfoutput> -- Damien McKenna - Web Developer - dmckenna@thelimucompany.com The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 ----- Excess quoted text cut - see Original Post for more ----- I've run upto 10 on the same page without problems (apart from users clicking Submit more than once :P), so I know the functionality will work > <cffile action="upload" filefield="form.tLogoFilename" Remove the "form." from the filefield, it's not needed or wanted Try this: Name the 3 fields as "FileUpload_1", "FileUpload_2" and "FileUpload_3" Then run your code with a <cfloop around them Also, your JS will only report one error before exiting the template (your <cfexit>) I'd also suggest displaying the message on the page, and then offering a link back - it will give the opportunity to show more than one message at the same time, rather than one popup Not forgetting that your popup doesn't say which image failed HTH For the filefield attribute, you need the name of the <input type="file">. The destination attribute has to be a directory (not a file!). You can find out the name of the uploaded file with #cffile.serverFile#. <cffile action="upload" filefield="tLogoFilename" destination="#variables.home_dir#media\images\clientlogos\" nameconflict="overwrite"> ----- Excess quoted text cut - see Original Post for more ----- > The destination attribute has to be a directory (not a file!). You can > find out the name of the uploaded file with #cffile.serverFile#. ??? From the CFML reference: Absolute pathname of directory or file on web server..... I know in the past I've used a filename here. --Ben Doom > Get rid of the cftry and cfcatch for now so you can see why > the cffile operation isn't working. The CF error should tell > you what's wrong. > > Greg Or, <cfcatch> <cfdump var="#cfcatch#"> <cfabort> <cfcatch> In my reference (cfmx): "Pathname of directory in which to upload the file. If not an absolute path (starting a with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory, which is returned by the GetTempDirectory function." I have never actually tried to specify the filename too. ----- Excess quoted text cut - see Original Post for more ----- > In my reference (cfmx): > "Pathname of directory in which to upload the file. If not an absolute > path (starting a with a drive letter and a colon, or a forward or > backward slash), it is relative to the ColdFusion temporary directory, > which is returned by the GetTempDirectory function." > > I have never actually tried to specify the filename too. Wierd. I'm looking at the MX reference, as well.... --BenD http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p35.htm#wp35 40091 I am not at all saying you are wrong. As I said, I haven't tried it with a filename. Pascal > > Wierd. I'm looking at the MX reference, as well.... > > --BenD My CFFILE issue is resolved. The previous developer defined the file extensions as hidden values and passed them as ""....and it was not recognizing the other two file extensions. So my images were being uploaded without the .gif or .jpg Why he'she wouldn't just upload the file name, I don't know... But I resolved it with the following: <cfset variables.textension = Right(form.tLogoFilename,3)> http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p35.htm#wp35 40091 I am not at all saying you are wrong. As I said, I haven't tried it with a filename. Pascal > > Wierd. I'm looking at the MX reference, as well.... > > --BenD _____ > From: Monique Boea > > <cfset variables.textension = Right(form.tLogoFilename,3)> Be careful about this - some people save images as .jpeg YIKES!! > <cfset variables.textension = Right(form.tLogoFilename,3)> Be careful about this - some people save images as .jpeg _____ yeah, you might want to to a <cfset variables.textension = listFirst(form.tLogoFilename ,'.')> or some variation of those arguments inside the function.. tw YIKES!! > <cfset variables.textension = Right(form.tLogoFilename,3)> Be careful about this - some people save images as .jpeg _____ > From: Tony Weeg > > yeah, you might want to to a > > <cfset variables.textension = listFirst(form.tLogoFilename ,'.')> > > or some variation of those arguments inside the function.. Don't you mean ListLast()? Some lovely people put full-stops in their file names as well full-stops? > yeah, you might want to to a > > <cfset variables.textension = listFirst(form.tLogoFilename ,'.')> > > or some variation of those arguments inside the function.. Don't you mean ListLast()? Some lovely people put full-stops in their file names as well _____ image.name.jpeg .......^ = full stop? maybe? I don't know. full-stops? > yeah, you might want to to a > > <cfset variables.textension = listFirst(form.tLogoFilename ,'.')> > > or some variation of those arguments inside the function.. Don't you mean ListLast()? Some lovely people put full-stops in their file names as well _____ > From: Monique Boea > > full-stops? Same as a Period http://dictionary.reference.com/search?q=full%20stop sure did :) > yeah, you might want to to a > > <cfset variables.textension = listFirst(form.tLogoFilename ,'.')> > > or some variation of those arguments inside the function.. Don't you mean ListLast()? Some lovely people put full-stops in their file names as well So what's the alternative? > <cfset variables.textension = Right(form.tLogoFilename,3)> Be careful about this - some people save images as .jpeg _____ ACtually, there is Javascript on the previous page that forces a three digit file extension. (BOOYAH!!) :) > <cfset variables.textension = Right(form.tLogoFilename,3)> Be careful about this - some people save images as .jpeg _____ On the action page make sure you are specifying three different form fields for the upload. Paste your action script and we can help more I have a CFFILE question: I have a form which allows a user to upload three different images at the same time I have three different <cffile action="upload".... tags on the processing page. The problem is it only uploads the very first image... Any suggestions? _____ I think full stops are periods. He might just be reminding you that there can be more than one period in the filename. a.1.b.2.c.jpeg Windows treats anything to the right of the final period as the extention. And it may be more than 3 characters long. Jerry Johnson so, the htought was that listLast() would get the files extension, regardless of the amount of (class can we all say our new word) "full stops", that are present in the filename. :) new word learned. cool! tw I think full stops are periods. He might just be reminding you that there can be more than one period in the filename. a.1.b.2.c.jpeg Windows treats anything to the right of the final period as the extention. And it may be more than 3 characters long. Jerry Johnson > From: Tony Weeg > > so, the htought was that listLast() would get the files > extension, regardless of the amount of (class can we all say > our new word) "full stops", that are present in the filename. It will, but I've seen code where somebody used ListFirst() on the period, and it fails horribly when people put full stops in the middle of a file name
|
February 09, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||