Skip navigation
danielmroberts
Currently Being Moderated

Zip file uploaded by CF can't be unzipped by CF or Java

May 7, 2008 12:43 PM

I'm having a WTF moment right now trying to track down this problem. I am creating a monitoring tool for our merge email system. What I would like to do is submit a job zip file through our upload form, in which case I just need to upload a zip file with cfhttp to the action page.

What I'm running into is a problem unzipping the file when it is on the server. However if I go to the server the received file opens fine with WinRAR or Windows Explorer. If I manually go to our form and upload the exact same file it works fine. Really odd. I can only find very basic information about uploading files with cfhttp and tried all of the attributes that seemed logical.

Attached is very basic example of the problem. It may end up being a bug in CF or something.

The code does the following
1. creates a text file
2. creates a zip file with the text file
3. tries to unzip the file to make sure it is fine
4. uploads the file (processed by a <cfelse> block at the bottom)
5. tries to unzip the file uploaded

The error occurs in step 5. CF just can't unzip the uploaded file, but I can unzip it using other tools.
================
  • Currently Being Moderated
    Community Member
    May 9, 2008 1:13 PM
    danielmroberts,

    I tested it and received the same error. Using GetHttpRequestData() I did notice the size of the received file is usually 2b bigger than original. Though I do not know if that matters at all.

    The strange thing is if you add another parameter after the zip file (an empty text file or a form field), it suddenly works.

    <cfhttp url=" http://#cgi.http_host##cgi.script_name#?upload" method="post" result="jobSubmitResult">
    <cfhttpparam name="zipfile" type="file" file="#path#temp.zip" />
    <cfhttpparam name="placeholder" type="FormField" value="Empty Field">
    </cfhttp>

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    May 9, 2008 1:45 PM
    You are welcome. Glad I could help :)
    |
    Mark as:
  • Currently Being Moderated
    Community Member
    May 9, 2008 1:47 PM
    > Using GetHttpRequestData() I did notice the size of the received file is usually 2b bigger than original.
    Whoops. That should be "using GetHttpRequestData() _and_ cfdirectory , I did notice ..."
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points