-
1. Re: Error uploading a file
EddieLotter Mar 1, 2016 11:13 AM (in response to LouieWarren)To get more details, temporarily try the following:
<cftry> <cffile action = "upload" fileField = "requiredFILENAME" destination = #newDest# accept = "application/pdf"> <cfcatch> <!--- <CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to upload your file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT# &IE_PMOMILCON_DT=#form.IE_PMOMILCON_DT#"> ---> <cfdump var="#cfcatch#"> <cfabort showError="debugging"> </cfcatch> </cftry>
I suspect you are getting a file collision.
Cheers
Eddie
-
2. Re: Error uploading a file
BKBK Mar 1, 2016 11:51 AM (in response to LouieWarren)Just
<cffile action = "upload"
fileField = "requiredFILENAME"
destination = "#newDest#"
accept = "application/pdf">
and Coldfusion will tell you what the matter is.
-
3. Re: Error uploading a file
WolfShade Mar 1, 2016 2:22 PM (in response to LouieWarren)Is the file being inserted into the database? Or does it reside on the web server and is somehow associated with a database record?
If the former, check the database table for unique constraints. If the file (or even the file name) already exists in the database and the constraint for unique binary value or unique filename is set, that could cause an issue.
Also, in your CFTRY/CFCATCH, set it to either email you a CFDUMP of cfcatch, or display it right on the page as EddieLotter suggested (remembering, of course, to remove that part before going to production.)
HTH,
^_^
-
4. Re: Error uploading a file
LouieWarren Mar 17, 2016 9:52 AM (in response to WolfShade)The file is stored in a directory elsewhere on the server and a pointer to that file is stored in the database.
I put in the debugging statements and tried again. I immediately got a 500 - Internal server error. I commented out the debug statement and tried again... yet another 500. Not sure what I have done. Here is the code fragment after I commented out the debug statement.
<cftry>
<cffile action = "upload"
fileField = "requiredFILENAME"
destination = #newDest#
accept = "application/pdf">
<cfcatch>
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to upload your file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#
&IE_PMOMILCON_DT=#form.IE_PMOMILCON_DT#">
<!--- <cfdump var="#cfcatch#">
<cfabort showError="debugging"> --->
</cfcatch>
</cftry>
-
5. Re: Error uploading a file
EddieLotter Mar 17, 2016 10:01 AM (in response to LouieWarren)LouieWarren wrote:
The file is stored in a directory elsewhere on the server and a pointer to that file is stored in the database.
If this is the process of uploading a file then surely there won't yet be a record in the database. Right?
Cheers
Eddie
-
6. Re: Error uploading a file
LouieWarren Mar 17, 2016 10:06 AM (in response to EddieLotter)I am assuming. The error is on the Production machine and it is in control of the government DBAs... I have a bunch of hoops to jump through to get a query run. Sucks to be me, huh? I'll have to submit the request. Thank you.
-
7. Re: Error uploading a file
BKBK Mar 17, 2016 12:48 PM (in response to LouieWarren)LouieWarren wrote:
The file is stored in a directory elsewhere on the server and a pointer to that file is stored in the database.
I put in the debugging statements and tried again. I immediately got a 500 - Internal server error. I commented out the debug statement and tried again... yet another 500. Not sure what I have done. Here is the code fragment after I commented out the debug statement.
<cftry>
<cffile action = "upload"
fileField = "requiredFILENAME"
destination = #newDest#
accept = "application/pdf">
<cfcatch>
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to upload your file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#
&IE_PMOMILCON_DT=#form.IE_PMOMILCON_DT#">
<!--- <cfdump var="#cfcatch#">
<cfabort showError="debugging"> --->
</cfcatch>
</cftry>
What happens when you comment out the entire code, like this?
<!---
<cftry>
<cffile action = "upload"
fileField = "requiredFILENAME"
destination = #newDest#
accept = "application/pdf">
<cfcatch>
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We
were unable to upload your file. Please try
again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#&IE_PMOMILCON_DT=#form.IE_PMOMILCON_DT#">
<cfdump var="#cfcatch#">
<cfabort showError="debugging">
</cfcatch>
</cftry>
--->
<cfdump var="#form#">
Do you get the form fields? If so, which?
-
8. Re: Error uploading a file
LouieWarren Mar 18, 2016 8:10 AM (in response to BKBK)500 Internal server error
-
9. Re: Error uploading a file
BKBK Mar 18, 2016 12:59 PM (in response to LouieWarren)Then something went wrong with the form submission. Could you share the form page with the forum?
-
10. Re: Error uploading a file
LouieWarren Mar 21, 2016 5:24 AM (in response to BKBK)I am a CF novice. I hope I've included the right part of the code. Here's the entire calling .cfm file:
<HTML>
<HEAD>
<TITLE>Upload 378</TITLE>
<link rel=stylesheet href="REDProj.css">
</HEAD>
<BODY>
<!--- <CFOUTPUT>#CGI.QUERY_STRING#</CFOUTPUT> --->
<CFOUTPUT>
<CFSET newDest = #authfileroot#&"378Docs\">
</CFOUTPUT>
<CFQUERY datasource="#datasource#" name="Getdata">
select FileLink from FM_FORM378_TRAN
where F378_ID=#FORM.F378_ID#
</CFQUERY>
<cfoutput>
<cfset oldfile=#newDest#&#Getdata.FileLink#>
</cfoutput>
<cfif #Getdata.FileLink# neq ''>
<cfif fileexists("#oldfile#")>
<cftry>
<cffile action = "delete" file=#oldfile#>
<cfcatch>
<!--- <CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to delete your old file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#&IE_PMOMILCON_DT=#form.IE_PMOM ILCON_DT#"> -->
<cfdump var="#cfcatch#">
<cfabort showError="debugging">
</cfcatch>
</cftry>
</cfif>
</cfif>
<CFIF IsDefined("URL.Action") AND URL.Action is "Upload">
<CFSET F378_ID = #FORM.F378_ID#>
<CFSET IE_PMO_DT = #FORM.IE_PMO_DT#>
<CFSET FMBIC_DT = #FORM.FMBIC_DT#>
<CFSET FILENAME = #FORM.requiredFILENAME#>
<CFSET IE_PMOMILCON_DT = #FORM.IE_PMOMILCON_DT#>
<CFIF variables.FILENAME is "">
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=You must select a file.&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#&IE_PMOMILCON_DT=#form.IE_PMOMIL CON_DT#">
</CFIF>
<!--- <cftry>
<cffile action = "upload"
fileField = "requiredFILENAME"
destination = #newDest#
accept = "application/pdf">
<cfcatch>
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to upload your file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#
&IE_PMOMILCON_DT=#form.IE_PMOMILCON_DT#">
<cfdump var="#cfcatch#">
<cfabort showError="debugging">
</cfcatch>
</cftry> --->
<cfdump var="#form#">
<CFOUTPUT><CFSET oldName = #newDest# & #CFFILE.ServerFile#></CFOUTPUT>
<CFOUTPUT><CFSET newName = #newDest# & #variables.F378_ID# &"_"& #CFFILE.ServerFile#></CFOUTPUT>
<cftry>
<CFFILE ACTION="Rename"
SOURCE=#oldName#
DESTINATION=#newName#>
<cfcatch>
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to rename your file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#&IE_PMOMILCON_DT=#form.IE_PMOM ILCON_DT#">
</cfcatch>
</cftry>
<CFQUERY datasource="#datasource#" name="add378">
update FM_FORM378_TRAN
set IE_PMO_DT=to_date('#FORM.IE_PMO_DT#','mm/dd/yyyy') ,
FMBIC_DT=to_date('#FORM.FMBIC_DT#','mm/dd/yyyy'),
IE_PMOMILCON_DT=to_date('#FORM.IE_PMOMILCON_DT#','mm/dd/yyyy'),
FileLink=#FORM.F378_ID# ||'_'|| '#CFFILE.ServerFile#'
where F378_ID=#FORM.F378_ID#
</CFQUERY>
<script language=javascript type='text/javascript'>
//opener.window.location=opener.window.location;
opener.window.location.reload();
self.close();
//return false;
</SCRIPT>
<CFELSE>
How did you get here!!!
<script language=javascript type='text/javascript'>
self.close();
</SCRIPT>
</CFIF>
</BODY>
</HTML>
Hopefully that shows what you need. Sorry to be dense.
-
11. Re: Error uploading a file
BKBK Mar 21, 2016 1:17 PM (in response to LouieWarren)That was the action page. I requested the form page.
In any case, you could do with fewer <cfoutput> tags and fewer # symbols:
<HTML>
<HEAD>
<TITLE>Upload 378</TITLE>
<link rel=stylesheet href="REDProj.css">
</HEAD>
<BODY>
<!--- <CFOUTPUT>#CGI.QUERY_STRING#</CFOUTPUT> --->
<CFSET newDest = authfileroot & "378Docs\">
<CFQUERY datasource="#datasource#" name="Getdata">
select FileLink from FM_FORM378_TRAN
where F378_ID=#FORM.F378_ID#
</CFQUERY>
<cfset oldfile=newDest & Getdata.FileLink>
<cfif Getdata.FileLink neq ''>
<cfif fileexists("#oldfile#")>
<cftry>
<cffile action = "delete" file="#oldfile#">
<cfcatch>
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to delete your old file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#&IE_PMOMILCON_DT=#form.IE_PMOM ILCON_DT#"> -->
<cfdump var="#cfcatch#">
<cfabort showError="debugging">
</cfcatch>
</cftry>
</cfif>
</cfif>
<CFIF IsDefined("URL.Action") AND URL.Action is "Upload">
<CFSET F378_ID = FORM.F378_ID>
<CFSET IE_PMO_DT = FORM.IE_PMO_DT>
<CFSET FMBIC_DT = FORM.FMBIC_DT>
<CFSET FILENAME = FORM.requiredFILENAME>
<CFSET IE_PMOMILCON_DT = FORM.IE_PMOMILCON_DT>
<CFIF variables.FILENAME is "">
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=You must select a file.&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#&IE_PMOMILCON_DT=#form.IE_PMOMIL CON_DT#">
</CFIF>
<cftry>
<cffile action = "upload"
fileField = "requiredFILENAME"
destination = "#newDest#"
accept = "application/pdf">
<cfcatch>
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to upload your file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#
&IE_PMOMILCON_DT=#form.IE_PMOMILCON_DT#">
<cfdump var="#cfcatch#">
<cfabort showError="debugging">
</cfcatch>
</cftry>
<cfdump var="#form#">
<CFSET oldName = newDest & CFFILE.ServerFile>
<CFSET newName = newDest & variables.F378_ID & "_" & CFFILE.ServerFile>
<cftry>
<CFFILE ACTION="Rename"
SOURCE="#oldName#"
DESTINATION="#newName#">
<cfcatch>
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=We were unable to rename your file. Please try again..&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#&IE_PMOMILCON_DT=#form.IE_PMOM ILCON_DT#">
</cfcatch>
</cftry>
<CFQUERY datasource="#datasource#" name="add378">
update FM_FORM378_TRAN
set IE_PMO_DT=to_date('#FORM.IE_PMO_DT#','mm/dd/yyyy') ,
FMBIC_DT=to_date('#FORM.FMBIC_DT#','mm/dd/yyyy'),
IE_PMOMILCON_DT=to_date('#FORM.IE_PMOMILCON_DT#','mm/dd/yyyy'),
FileLink=#FORM.F378_ID# ||'_'|| '#CFFILE.ServerFile#'
where F378_ID=#FORM.F378_ID#
</CFQUERY>
<script language=javascript type='text/javascript'>
//opener.window.location=opener.window.location;
opener.window.location.reload();
self.close();
//return false;
</SCRIPT>
<CFELSE>
How did you get here!!!
<script language=javascript type='text/javascript'>
self.close();
</SCRIPT>
</CFIF>
</BODY>
</HTML>
-
12. Re: Error uploading a file
es336td Mar 22, 2016 4:46 AM (in response to BKBK)As I said earlier, I'm a novice with very little CF experience. I'm normally an Oracle DBA and was thrown into this because the customer thought that is what they needed. In actuality, they needed a CF developer with a little Oracle experience as opposed to the opposite. That said, you are talking about the pop-up form to select the file to upload? What tag would that have? Once again, sorry to be dense.
-
13. Re: Error uploading a file
LouieWarren Apr 13, 2016 9:30 AM (in response to es336td)This?
<FORM method="post" action="upload378Act.cfm?Action=Upload" onSubmit="return checkform(this)" enctype="multipart/form-data"> <TABLE width="100%"> <tr> <td align=center valign="top" colspan="3"> <FONT style="FONT: bold 12pt Arial; color: darkblue;"> Upload 378 </FONT> <BR> <CFIF IsDefined("URL.ERROR")> <FONT style="FONT: bold 8pt Arial; color: red;"> <CFOUTPUT>#URL.ERROR#</CFOUTPUT> </FONT> </CFIF> <INPUT type="hidden" name="F378_ID" value="<CFOUTPUT>#URL.F378_ID#</CFOUTPUT>"> </td> </tr> <tr> <td> <cfif #getdata.budgetprogramID# is 120 or #getdata.budgetprogramID# is 110> <b>SAF/IEI PMO MILCON Date</b> </cfif> </td> <td><b>SAF/IEI PMO Appr Date</b></td> <td><b>SAF/FM Coord Date</b></td> </tr> <tr> <CFOUTPUT> <td> <cfif #getdata.budgetprogramID# is 120 or #getdata.budgetprogramID# is 110> <INPUT type="text" name="IE_PMOMILCON_DT" size="15" <CFIF IsDefined("URL.IE_PMOMILCON_DT")> value="#URL.IE_PMOMILCON_DT#"</CFIF> readonly> <A HREF="2" onClick="cal.select(document.forms[0].IE_PMOMILCON_DT,'anchor2','MM/dd/yyyy'); return false;" NAME="anchor2" ID="anchor2"> <img alt="Select a date" height=16 width=21 src="../../Images/pdate.gif" border=0> </A> <cfelse> <INPUT name="IE_PMOMILCON_DT" type="hidden" <CFIF IsDefined("URL.IE_PMOMILCON_DT")> value="#URL.IE_PMOMILCON_DT#"</CFIF>> </cfif> </td> <td><INPUT type="text" name="IE_PMO_DT" size="15" <CFIF IsDefined("URL.IE_PMO_DT")> value="#URL.IE_PMO_DT#"</CFIF> readonly> <A HREF="1" onClick="cal.select(document.forms[0].IE_PMO_DT,'anchor1','MM/dd/yyyy'); return false;" NAME="anchor1" ID="anchor1"> <img alt="Select a date" height=16 width=21 src="../../Images/pdate.gif" border=0> </A> </td> <td><INPUT type="text" name="FMBIC_DT" size="15" <CFIF IsDefined("URL.FMBIC_DT")> value="#URL.FMBIC_DT#"</CFIF> readonly> <A HREF="3" onClick="cal.select(document.forms[0].FMBIC_DT,'anchor3','MM/dd/yyyy'); return false;" NAME="anchor3" ID="anchor3"> <img alt="Select a date" height=16 width=21 src="../../Images/pdate.gif" border=0> </A> </td> </CFOUTPUT> </tr> <tr> <td colspan="3"> <b>Select File and Upload</b><BR> <input type="file" name="requiredFILENAME" size="50"><BR> *Only file type accepted: *.pdf </td> </tr> <tr> <td colspan="3" align="right"> <input type="submit" value="Save" style="BACKGROUND-COLOR:#ffffcc;FONT: bold 8pt Arial;COLOR: #000080;BORDER-LEFT: 0px; BORDER-TOP:0px; width:100px; height:18px"> </td> </tr> </TABLE> </FORM>
-
14. Re: Error uploading a file
LouieWarren May 16, 2016 6:54 AM (in response to BKBK)I've been sidetracked with that other issue we worked through. Did I give the code snippet you needed?
The customer sent an e-mail this morning stating that she remembered this issue happening before and that the solution or workaround was the filename could not contain special characters. I don't think that is it, but at this point, since I don't really know what I'm doing, I'm willing to try anything.
-
15. Re: Error uploading a file
EddieLotter May 16, 2016 11:59 AM (in response to LouieWarren)Yes, you provided the relevant snippets.
Can you reproduce the problem yourself or are you relying on the customer to do the testing?
Cheers
Eddie
-
16. Re: Error uploading a file
LouieWarren May 17, 2016 6:56 AM (in response to EddieLotter)I do all the testing. The customer, being impatient, constantly tries to upload, I am assuming, thinking that time will solve the issue, or that I fixed it and didn't tell her. She just recently sent the e-mail that said, previously, the filename was including the entire path of where the file resided, which caused problems. That was in 2012, and the programmer at the time, fixed it. The customer has no clue. I liken their knowledge of the app and how it works to the old custom of bleeding the patient to get out the bad blood.
All that aside, in my testing, it still fails to upload.
-
17. Re: Error uploading a file
EddieLotter May 17, 2016 7:03 AM (in response to LouieWarren)Okay, since you can reproduce the problem we may have something to work with.
Look at my first response to your original post. I removed the redirect you are using to handle errors and added code to display the exception details. Please use that code and post the text of the exception for us to have a look at.
Cheers
Eddie
-
18. Re: Error uploading a file
LouieWarren May 17, 2016 8:08 AM (in response to EddieLotter)I think I put it in the right place:
<CFIF IsDefined("URL.Action") AND URL.Action is "Upload">
<CFSET F378_ID = #FORM.F378_ID#/>
<CFSET IE_PMO_DT = #FORM.IE_PMO_DT#/>
<CFSET FMBIC_DT = #FORM.FMBIC_DT#/>
<CFSET FILENAME = #FORM.requiredFILENAME#/>
<CFSET IE_PMOMILCON_DT = #FORM.IE_PMOMILCON_DT#/>
<cftry>
<cffile action = "upload"
fileField = "requiredFILENAME"
destination = #newDest#
accept = "application/pdf">
<cfcatch>
<!--- <CFIF variables.FILENAME is "">
<CFLOCATION url="upload378.cfm?F378_ID=#FORM.F378_ID#&ERROR=You must select a file.&FMBIC_DT=#FORM.FMBIC_DT#&IE_PMO_DT=#FORM.IE_PMO_DT#&IE_PMOMILCON_DT=#form.IE_PMOMIL CON_DT#">
</CFIF> --->
<cfdump var="#cfcatch#">
<cfabort showError="debugging">
</cfcatch>
</cftry> <cfdump var="#form#">
The error message now tells me the path, where the uploaded file is stored, isn't valid. It exists.
The value of the attribute destination, which is currently \xxxxxx\secure\Authorization\378Docs\, is invalid.
Do you need to see the whole error page?
Sorry for the crappy formatting. I still haven't figured out how to format the code with the line numbers. I did once, but can't seem to do it again.
Thank you.
-
19. Re: Error uploading a file
EddieLotter May 17, 2016 8:49 AM (in response to LouieWarren)To format code, click on the "Use advanced editor" link at the top, right of the input box, highlight the text to format, then click the >> button in the toolbar.
Does the value of newDest contain a drive letter or is it a UNC path?
Cheers
Eddie
-
20. Re: Error uploading a file
bloodbanker May 17, 2016 9:11 AM (in response to LouieWarren)Just a thought, what if you added enctype="multipart/form-data" to the form?
-
21. Re: Error uploading a file
EddieLotter May 17, 2016 9:27 AM (in response to bloodbanker)Good thought, but he already has that.
Cheers
Eddie
-
22. Re: Error uploading a file
bloodbanker May 17, 2016 9:29 AM (in response to EddieLotter)Hmm, OK. I searched this page and didn't see it.
That's all I had to offer, good luck.
-
23. Re: Error uploading a file
LouieWarren May 17, 2016 9:45 AM (in response to EddieLotter)UNC - \xxxxxx\secure\Authorization\378Docs\
The \xxxxxx is the root where the code resides and the directory to store the uploaded file.
-
24. Re: Error uploading a file
EddieLotter May 17, 2016 9:53 AM (in response to LouieWarren)Remember that when the server reports that it cannot access a location, it is the user account that the CF process is using that might have problems accessing an existing location.
As a debugging step, try adding the following code to verify that the server can see a file that you know exists:
<cfif fileExists(newDest & 'filename.ext')> The file is visible to the server. <cfelse> The file is not visible to the server. </cfif>
Cheers
Eddie
-
25. Re: Error uploading a file
LouieWarren May 17, 2016 10:03 AM (in response to EddieLotter)I plugged it in before and after the debug code and no change. I'm sure I didn't do it correctly.
-
26. Re: Error uploading a file
EddieLotter May 17, 2016 10:22 AM (in response to LouieWarren)When you say "no change" do you mean you are not seeing either of the "The file is..." messages displayed on the Web page?
Create a new, temporary page with the test code I recently posted.
Cheers
Eddie
-
27. Re: Error uploading a file
LouieWarren May 17, 2016 10:53 AM (in response to EddieLotter)I deleted everything but the test code and got the message The file is not visible to the server. I put the original file back and the same message came up. I missed it in the original error page. The variable newDest is assigned earlier in the page:
<CFOUTPUT> <CFSET newDest = #authfileroot#&"378Docs\"/> </CFOUTPUT>
Which gives the correct location displayed in the error message. What am I not understanding?
-
28. Re: Error uploading a file
EddieLotter May 17, 2016 12:04 PM (in response to LouieWarren)It's time to get your network administrator involved. And the server administrator if they are not the same person.
If ColdFusion cannot access a file, that you know to exist, then the user account that the ColdFusion service is using, doesn't have the necessary security privileges to access that folder. Only your administrator(s) can sort out security problems.
Cheers
Eddie
-
29. Re: Error uploading a file
LouieWarren May 18, 2016 9:46 AM (in response to EddieLotter)I've had the SysAdmin involved and he ensures me (with screen shots) that everything is correct and that it is my problem. I had another error with this app, earlier, where it was trying to produce a report (an Excel spreadsheet) and it threw the error message, "access denied". I was able to go to the directory in FTP and change the permissions to 777 and it worked. I will attempt that with this, but I don't see how it would change the not found issue.
-
30. Re: Error uploading a file
EddieLotter May 18, 2016 3:17 PM (in response to LouieWarren)It occurs to me that you said it is a UNC path, but you aren't showing the initial double-backslash in your posts. You are using one in your code, right?
For example: \\MachineName\folder\subfolder\file.ext
Cheers
Eddie
-
31. Re: Error uploading a file
LouieWarren May 19, 2016 5:54 AM (in response to EddieLotter)Ok, it's highly likely I misunderstood UNC...
The directory is assigned in Application.cfc
<cfset authfileroot="\xxxxxxxx\secure\Authorization\">
In the .cfm I am working with, the storage location of the uploaded file is assigned as such:
<CFOUTPUT> <CFSET newDest = #authfileroot#&"378Docs\"/> </CFOUTPUT>
I hope that answers your question.
-
32. Re: Error uploading a file
EddieLotter May 19, 2016 6:15 AM (in response to LouieWarren)Yes, that makes more sense.
You are not specifying which drive the folder is on.
Is it a local hard drive on the server or is it a network share?
If it is a local hard drive, then add the drive letter (like C: or D:) however, if it is a network share, then use a UNC path, which your SysAdmin can give you.
Cheers
Eddie
-
33. Re: Error uploading a file
LouieWarren May 19, 2016 7:21 AM (in response to EddieLotter)I believe it's a local drive. It's the same drive that contains the CF code. When you select the option to upload the file, you are in the same directory where the code for that option resides. There is a subdirectory that is defined (as mentioned earlier) where the physical uploaded file resides and a link to that file is stored in the database.
The biggest issue I have is, 1) it worked flawlessly up until a little while ago (beginning of this thread) 2) the gov't sysadmin says that nothing has been done to change directories or permissions 3) there are no references to drive letters in any part of the code. The way I get it in my simple mind is, when you log in, you are virtually logging in as the schema/user for the database and all the files and database are yours to update as the application allows. What would have caused this to suddenly change after working fine for a while? Newer version of Windows? CF? Supposedly my development server, the Test server, and the Production server are all running the same version of Windows, CF, and Oracle. The original code was written with CF 8 and I believe we're at 11 now. I found a few things that caused me issues between the old and new versions of CF (i.e.- getbuiltin scopes), but nothing like this.
-
34. Re: Error uploading a file
EddieLotter May 19, 2016 7:43 AM (in response to LouieWarren)If you don't provide an explicit path, ColdFusion will rely on the Windows process' "current directory" when using the <cffile> tag, which differs from tags like <cfinclude> where CF uses the current script's folder as the "current directory."
The current directory of a Windows process is complicated and fragile. It's best to be explicit by using a full path including the drive, even if it doesn't fix your current problem.
I can't answer your questions as to why your script no longer works, but using an explicit path will rule out the unexpected results of the current directory not being what you expect it to be.
Cheers
Eddie
-
35. Re: Error uploading a file
LouieWarren Jun 24, 2016 11:16 AM (in response to EddieLotter)The only explicit path in all the code is
\\servername\test\sites\codebase directory structure
The Gov't SysAdmins are running 50 or so applications/databases on a VMWare Server. They have said they can't (won't) give me a more explicit path. So I guess I am screwed. The biggest issue I have at present is why it couldn't upload the file. Just the generic message: We were unable to upload your file. Please try again..
I have CF Admin debugging on and don't see anything significant. Trying again just gives the same error. At first I thought it was due to special characters in the filename and changed the file name to eliminate special characters and embedded blanks. No change. Really baffled.
-
36. Re: Error uploading a file
WolfShade Jun 24, 2016 12:55 PM (in response to LouieWarren)CFTRY/CFCATCH/CFDUMP will at least alert you to the issue, with specifics. I just now noticed in your first post that there already is a CFTRY/CFCATCH, but all it is doing is redirecting to another page with a lot of URL parameters, one of which is the error message text. If you were to put a CFMAIL (type="html") with a CFDUMP of the #cfcatch# variable, you should see what is triggering the error.
As far as I know, you cannot use "\\servername\path\to\upload\" for cffile uploads. If you use a relative path (ie, "/path/to/folder/") then CF will use that in relation to the CF temp folder, which resides within CFIDE, I think. You must use something like "F:/path/to/folder/". Unless you're in a unix/linux environment. (NOTE: If you can use a URL as a location, you'll have to use CFFTP to FTP the file - CFFILE does not work across servers.)
If the sysadmins will not assign a full physical drive path, then tell them that the only alternative is to store the files in the database. The upside to this is that if you ever have to delete one, you just delete it in the database, as opposed to deleting the reference from the database AND using cffile action="delete" to remove the binary, itself. The downsides are A) depending upon the file sizes, you could bloat the database; and B) if the site/app has over a certain number of users, this will bottleneck your network. (Third edit: If space on the webserver is an issue, there's always SAN storage.)
HTH,
^_^
-
37. Re: Error uploading a file
EddieLotter Jun 27, 2016 8:26 AM (in response to LouieWarren)That "generic" message is coming from the code that you quoted in your very first post here. It is not a ColdFusion message. We asked you to temporarily remove that line of code because it is masking the ColdFusion message.
Please do so and then let us know what message ColdFusion is giving you.
Cheers
Eddie
-
38. Re: Error uploading a file
LouieWarren Jun 27, 2016 10:26 AM (in response to EddieLotter)With all the things that are wrong with this mess I inherited, I skipped over your comment. My apologies.
I did as you suggested and ended up having to completely delete the error message because, even commented out it still gave me the message. I copied the file and made changes to the new one. Loaded it up to the directory and got this message:
The value of the attribute destination, which is currently \TestServer\secure\Authorization\378Docs\, is invalid.
I checked the directories in the FTP tool I use to upload and the directory is there and it is spelled correctly. No clue what to do with this.
-
39. Re: Error uploading a file
BKBK Jun 27, 2016 10:42 AM (in response to LouieWarren)This is going on a bit. Is it still about uploading a file?