<cfcontent> deletefile parameter problem

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default <cfcontent> deletefile parameter problem

    I am using cfheader and cfcontent to deliver a dynamically generated excel
    document to the browser. On delivery of the excel document I want to delete it
    from the server using the cfcontent tags deletefile parameter, but whenever I
    add that paramater and set it to yes, I am receiving the following error
    (embedded in the excel document). 'Error occurred while attempting to delete
    the file
    C:\Inetpub\wwwroot\asa\administration\members\memb er_lists\MbrList_050415.xls.'
    Here is my code:
    ------------------------------------------------------------------- ..query
    getting data... ... using <cffile.. to create .xls document.... .. then
    outputing with <cfheader name='Content-Disposition'
    value='filename=#FileName#'> <cfcontent type='application/unknown'
    file='#FileLocation##FileName#' deletefile='Yes'>
    ------------------------------------------------------------------- Any
    suggestions on why I might be getting this error ?? Many thanks in advance.

    jjay@aus Guest

  2. Similar Questions and Discussions

    1. problem downloading using CFCONTENT & CFHEADER
      I am running into the same problem. Please reply if you find any fix to this problem. Thanks
    2. cfcontent problem
      my codes is like this: <table> <tr> <td>Hello World</td> </tr> </table> <cfcontent file="image/image.jpg" type=".........jpeg......."> and...
    3. cfcontent filename problem
      Hello all- I'm trying to use cfcontent to force the download of an exe. The problem is that when the save to disk dialog box opens, the filename...
    4. DateFormat and cfcontent problem
      I wonder why the following will not output to msword: -------------------------------------------------------------------------------- ----------...
    5. DeleteFile doesn't work in Session_OnEnd???
      I can successfully delete files using fso.DeleteFile when in an ASP script. But in Session_OnEnd, where I'd *really* like to clean up files, it...
  3. #2

    Default Re: <cfcontent> deletefile parameter problem

    I'm Getting the SAME EXACT problem. And it's a recent problem. Could it be a
    hot fix that was updated to windows 2000 server?

    it works a while on reboot, and then just starts giving that error again. NT
    ERROR 5 and cannot delete the file after
    the CFCONTENT is displayed.

    What a pain. Some macromedia help would be nice!

    mratner Guest

  4. #3

    Default Re: <cfcontent> deletefile parameter problem

    Hi There, I would be very interested in learning how to use CFFILE/CFCONTENT
    to create/display an EXCEL document. Would you mind sharing the code? The way
    that I create XLS sheets now is by: 1) Writing comma seperated values to a
    file using CFFILE 2) Use CFLOCATION or JavaScript to open the file created by
    merely using the filename. I've never had any problems using this technique,
    but I would like to learn how you are using it and what the pitfalls are of
    doing it the way that I have been.... Kind Regards, Peter

    SpiderFromMars Guest

  5. #4

    Default Re: <cfcontent> deletefile parameter problem

    Hi Peter, I have gone back to using cflocation as well. I just had too many
    problems with cfcontent (see my other topic I posted after this one). What I
    do do differentl to you however is when creating the file, I use HTML to create
    document (using cffile) and save it directly with a .xls extension. This
    allows for greater control over the formatting of headings etc.. Again, check
    out the other topic I posted after this one to see a code sample.

    jjay@aus Guest

  6. #5

    Default Re: <cfcontent> deletefile parameter problem

    Very interesting code. So, if you save it as EXCEL, it is apparent that <TD>'s
    are counted as columns and <TR>'s act as rows. I'll give this a try and see
    how it comes out... the only difference is that I'll use CFLOCATION vice
    CFHEADER.... <cfheader name='Content-Disposition' value='inline;
    filename=File.xls'> <cfcontent type='application/unknown'> <table
    border=1><tr><td><b>Member
    No.</b></td><td><b>Category</b></td><td><b>Name</b></td><td><b>Address
    1</b></td><td><b>Address 2</b></td><td><b>Address
    3</b></td><td><b>City</b></td><td><b>State</b></td><td><b>Postcode</b></td><td><
    b>Country</b></td></tr> <cfoutput query='Members'>
    <tr><td>#member_number#</td><td>#description#</td><td>#name#</td><td>#address_1
    #</td><td>#address_2#</td><td>#address_3#</td><td>#address_city#</td><td>#addres
    s_state#</td><td>#address_postcode#</td><td>#address_country#</td></tr>
    </cfoutput> </table>

    SpiderFromMars Guest

  7. #6

    Default Re: <cfcontent> deletefile parameter problem

    That's right. You can also use a lot of other HTML Formatting such as <b> tags
    and styles. A good way to get styles is to open an excel document, style it
    how you like it and then view the source for the excel document (save as a .txt
    and open n notepad or something) and pull out the style code to then use when
    writing your file.

    jjay@aus Guest

  8. #7

    Default Re: <cfcontent> deletefile parameter problem

    I have a problem with the delete parameter. I set to 'Yes' and it
    doesn't delete the file.
    I have seen 'application/unknown' used for the cfcontent type
    parameter.
    Some of the information I have come across besides unknown and
    specifically related to Excel applications also uses the following:
    vnd.ms-excel x-msexcel ms-excel msexcel and x-excel

    Where can I find out what the differences are between these values?
    Is my problem even related to the type parameter?

    My Code follows:
    <cfcontent type="application/vnd.ms-excel"
    File="#newTemplate#"
    deletefile = "YES">

    Thanks!

    michael.manganelli@citigroup.com Guest

  9. #8

    Default Re: <cfcontent> deletefile parameter problem

    I have a problem with the delete parameter. I set to 'Yes' and it
    doesn't delete the file.
    I have seen 'application/unknown' used for the cfcontent type
    parameter.
    Some of the information I have come across besides unknown and
    specifically related to Excel applications also uses the following:
    vnd.ms-excel x-msexcel ms-excel msexcel and x-excel

    Where can I find out what the differences are between these values?
    Is my problem even related to the type parameter?

    My Code follows:
    <cfcontent type="application/vnd.ms-excel"
    File="#newTemplate#"
    deletefile = "YES">

    Thanks!

    michael.manganelli@citigroup.com Guest

  10. #9

    Default Re: <cfcontent> deletefile parameter problem

    Hi Jjay@aus,

    I've been playing with saving HTML files out with XLS extensions and have been
    having a brilliant time.

    But, I am having problems with background colors that maybe you can help me
    with.

    Can you please take a minute to check out this code and open it in EXCEL?

    You'll see (hopefully) that the blue background goes all the way across the
    spreadsheet and does not keep itself in the cells that have content.

    How can I change the HTML to get the blue background color to stay where it
    logically should be staying.

    Thanks for any help you can give me...
    Peter

    ---------The Code -------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>TOPIC Page Modification Report</title>

    <style type="text/css">
    <!--

    table {
    border: 1px solid #000000;
    }

    td {
    border: 1px solid #000000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    }

    th {
    border: 1px solid #000000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
    }
    -->
    </style>

    </head>
    <body>
    <table width="660px">

    <tr bgcolor="33CCFF" style="font-size: 16px; font-weight: bold;">

    <td colspan="2">FMIS Project</td>

    <td>Size</td>

    <td>Date Last Modified</td>

    </tr>

    <tr bgcolor="33CCFF" style="font-size: 16px; font-weight: bold;">

    <td colspan="4">

    Total Number of Pages: 1

    </td>

    </tr>

    <tr>

    <td>1</td>

    <td>\FMIS\FMIS.cfm</td>

    <td>11557</td>

    <td>13/06/2002 11:10</td>

    </tr>

    </table>

    <br><br>

    </body>

    </html>





    SpiderFromMars Guest

  11. #10

    Default Re: <cfcontent> deletefile parameter problem

    Hi Peter, try specifying the bgcolor for each cell rather than the row (see
    code below). You could probably do it with styles as well, but as exel is a
    microsoft product it will probably be some long convoluted 300 char style
    setting.
    This way is probably the easiest.

    Cheers

    ----------------------------

    <table width="660px">

    <tr style="font-size: 16px; font-weight: bold;">
    <td bgcolor="33CCFF" colspan="2">FMIS Project</td>
    <td bgcolor="33CCFF">Size</td>
    <td bgcolor="33CCFF">Date Last Modified</td>
    </tr>

    <tr style="font-size: 16px; font-weight: bold;">
    <td bgcolor="33CCFF" colspan="4">
    Total Number of Pages: 1
    </td>
    </tr>

    <tr>
    <td>1</td>
    <td>\FMIS\FMIS.cfm</td>
    <td>11557</td>
    <td>13/06/2002 11:10</td>
    </tr>

    </table>



    jjay@aus Guest

  12. #11

    Default Re: <cfcontent> deletefile parameter problem

    That worked perfectly! Thank you!!

    It was all a matter of doing it at the cell level... not the row level.

    Then there was much rejoicing.... yey!!

    Peter
    SpiderFromMars Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139