Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with cffile

Status
Not open for further replies.

AgentFitz

Technical User
May 19, 2006
2
US
Hello all. I am having a problem with <cffile> that I wanted to see if you could help with. The first thing I will point out is that this code is working on our web server here at work, however I tried, unsuccessfully, to use the same basic code on a remote server (hosted by godaddy) with no results.

It is a very simple form designed only to upload a document to a directory on the server. Initially, I thought I simply did not have the server path correct, and I was getting a "page not found" error. Then I spoke with godaddy and they directed me here for the absolute path on my server:
Now, instead of the page not found error, I'm receiving the following error:


Error Occurred While Processing Request
String index out of range: -9

Please try the following:
Enable Robust Exception Information to provide greater detail about the source of errors. In the Administrator, click Debugging & Logging > Debugging Settings, and select the Robust Exception Information option.
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.

Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Remote Address 168.215.114.242
Referrer Date/Time 19-May-06 05:51 AM


And it's weird, the value after the "string index out of range:" seems to correspond with the length of the file name that's trying to be uploaded.

Lastly, I will mention as well that the godaddy rep was telling me that I won't be able to upload directly to a folder within my web structure, but rather to a shared "temp" folder somewhere else on the server. This didn't sound right to me, but I wanted to check with you guys and see if such a claim makes sense. Anyway, here is the code -

form page:
<form action="uploadaction.cfm" enctype="multipart/form-data" method="post">
<div align="left">
<input name="FiletoUpload" type="file" class="TableCellText" size="65">
</div>
<div align="left">
<input name="submit" type="submit" class="TableCellText" value="Upload">
</div>
</form>





action page:
<cffile action="upload"
destination="/home/content/f/i/t/fitzgerald2006/html/temp"
nameconflict="overwrite"
filefield="Form.FiletoUpload">

<cfoutput> You uploaded <strong>#cffile.ClientFileName#.#cffile.ClientFileext# </strong>succesfully.</cfoutput>


Sorry for the exceedingly long post. Any help is greatly appreciated!

Thanks,
Brian
 
Hmmm, well for starters you should really have the "accept" syntax in your CFFILE tag. The accept syntax will allow only the file extension you specified to be uploadable (like JPG or PDF - more of a security thing then anything else)
Code:
EX:
  <cffile action = "upload" fileField = "FileContents" destination = "c:\web\uploads\" [b]accept = "text/html"[/b] nameConflict = "MakeUnique">

With that said, shouldn't your destination have a drive letter mapped? Look at the above example, it dictates to save the file in the C: drive and then work its way down to the folder.

Your code is correct, if adding the drive letter doesn't help, contact godaddy and ask them if they enabled CFFILE on their servers. Tell them that the code works fine on your development server but not on the production server.

____________________________________
Just Imagine.
 
This may or may not be part of your problem, but cf 7.0.1 without the hot fix, has an error with cffile having the destination as a directory. It may not be related, but it is something to look in to.
 
thank you for the responses!

Thanks GUJU for the "accept" tip -- much appreciated.

Kevin was correct in mentioning, though, that the server is on a Linux platform, and thus (I guess) does not use drive letter names, etc. for it's paths.

This link below describes the path, which godaddy assures me is the "absolute path for my Linux hosting account"


but still no luck! any other ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top