• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

File Upload Help

New Here ,
Jun 07, 2007 Jun 07, 2007

Copy link to clipboard

Copied

I'm trying to create a form that will allow my users to submit an article by uploading a word document but when I submit the form it takes me to a page that says that the page I'm trying to reach has errors and can't be displayed. If I refresh the page it looses the information I was trying to pass and just shows me the text of the page without uploading anything. I've tried debugging the pages on my testing server but it can't find any errors and since the error page on my hosted site won't tell me anything specific I'm stuck.

Here’s the code on my form.

<form action="article_approve.cfm" method="post" enctype="multipart/form-data" name="submitArticle" id="submitArticle">
<input name="article" type="file" class="style2" id="article" size="30" maxlength="100" />
<input name="uploadArticle" type="submit" id="uploadArticle" value="Upload Article" />

Here’s the code on my approve page.
<cfif isdefined("form.submitArticle")>
<cffile action="upload" destination="httpdocs\backend\articles\" filefield="article" nameconflict="makeunique" accept="application/msword" >
</cfif>

Thanks in advance!
TOPICS
Advanced techniques

Views

677

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2007 Jun 07, 2007

Copy link to clipboard

Copied

Instead of <cfif isdefined("form.submitArticle")>

try <cfif len(trim("form.article")) gt 0>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2007 Jun 07, 2007

Copy link to clipboard

Copied

Still not working but this time it did have this at the bottom. (Not that it sheds any light on anything.)

HTTP 500 - Internal server error
Internet Explorer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 07, 2007 Jun 07, 2007

Copy link to clipboard

Copied

JessiBB wrote:
> Still not working but this time it did have this at the bottom. (Not that it sheds any light on anything.)
>
> HTTP 500 - Internal server error
> Internet Explorer

Your ISP is NOT displaying ColdFusion errors, this is an CF
Administrator setting. Maybe you can ask them to turn this on to
provide you more details.

A quick glance at your code did not show any obvious problems. My first
guess would be file permission problems. That the location you are
trying to write the uploaded file is not letting you.

You might try putting <cftry><cfcatch></cfcatch><cftry> blocks around
your code and output the error with this so that you don't have to rely
on the ISP error handling.

This is a good general practice anyway.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 07, 2007 Jun 07, 2007

Copy link to clipboard

Copied

P.S.

Basic ISP accounts often disable <cffile ....> functionality. Are you
sure you are allowed to upload files with your hosting account?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 07, 2007 Jun 07, 2007

Copy link to clipboard

Copied

1. The destination attribute requires the full physical path to the upload folder.

destination="#expandPath('httpdocs')#\backend\articles\"

2. Make sure you have write permission on that folder.

3. What Ian said.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 12, 2007 Jun 12, 2007

Copy link to clipboard

Copied

LATEST
Thanks so much everyone.! It works!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation