Posted file always empty?

Jun 3, 2009 at 7:51 PM

I am hoping I'm doing something very wrong here, every file I upload through this control comes out as 0 bytes. I'm using the most current control, version 2.0.3420.0.

I have tried a very basic page using the following code:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestUpload.aspx.vb" Inherits="UView_Intranet_Resources_Site.TestUpload" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server" enctype="multipart/form-data">
    <div>
   
        Test Upload Form:<br />
        <br />
        <fjx:FileUploader ID="FileUploader1" runat="server" >
            <Adapters>
                <fjx:FileSaverAdapter Runat="server" FolderName="TempFldr" />
            </Adapters>
        </fjx:FileUploader>

    </div>
    </form>
</body>
</html>

I have tried several folders, and in each one the files get created but are always 0 bytes (tried 10 byte files, 40mb files, etc).  I have gone as far as allowing everyone full control to this folder, setting IIS to allow folder writes.  I have also downloaded the project source code and compiled in with my VStudio 2008 ASP.NET project and when debugging I found that the HttpPostedFile in FileSaverAdapter.ProcessFile comes out with a ContentLength of -2...

Is there a typical cause for this type of issue?

Coordinator
Jun 3, 2009 at 9:00 PM

I can't think of any reason. Use fiddler to see what exception you got from the server. Perhaps security related?

Jun 4, 2009 at 5:12 PM

I'm learning my way through Fiddler now, and have come across a few points of interest...

- When I use a standard HTML file input, with a POST & multipart/form-data form the uploaded file is also 0 bytes.
- When I use another control, DJUpload, the file uploads without troubles.

I have compared some things through Fiddler between the DJUpload control and the file input & Flajaxian control, and here's something I thought was odd...  On the file & Flajaxian uploads the Inspector shows the following:

POST /GeneralApps/FileUpload.aspx?__ID=ctl00_PageContent_fjx_Uploader&__AspCookie.Session=hfe0u1rtui1ork45zc1jnx55& HTTP/1.1
Accept: text/*
Content-Type: multipart/form-data; boundary=----------Ef1Ef1ae0GI3Ef1Ij5GI3ei4ae0ei4
User-Agent: Shockwave Flash
Host: utildev.uview.com
Content-Length: 29108
Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=hfe0u1rtui1ork45zc1jnx55

------------Ef1Ef1ae0GI3Ef1Ij5GI3ei4ae0ei4
Content-Disposition: form-data; name="Filename"

Projects - 2009.doc
------------Ef1Ef1ae0GI3Ef1Ij5GI3ei4ae0ei4
Content-Disposition: form-data; name="Filedata"; filename="Projects - 2009.doc"
Content-Type: application/octet-stream

��ࡱ�

It shows the MIME header with no data for the file...  On the DJUpload control the response shows a list of HTTP-Accept types (jpg, word, excel, etc) along with the actual uploaded file encoded...

I will keep learning with Fiddler and see what else I can figure out.  Thanks in advance for any other ideas or tips anyone may have!

Jun 4, 2009 at 6:09 PM

Got it!

I should have thought of this in the first place.  I still had the other upload control, DJUpload, installed & in-use within my VS2008 project...  Because of the way that control integrates with the entire site it was causing some sort of problem with any other upload methods, making the uploaded files blank.

I've removed all references to this control and Flajaxian and the html file input are working perfectly.

Coordinator
Jun 4, 2009 at 6:47 PM

Probably your other control had a request handler or module - changing the request.

Thanks for sharing that it's good to know as a potential reason for a similar problem.