Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread Upload Bug - IE Only
Thu, Jul 19 2012 7:05 AMPermanent Link

Mark Brooks

Slikware

Avatar

Tim,

I have returned from a few days away and started to code up my file upload mechanism using the new capabilities. Initially this is a very simple single file upload testbed. All works great in Safari, Chrome and FireFox. Not so, however, in IE9.

My code simply uses a TFileUploadButton to select the file, then a call to SubmitForm using a TPage as the output.

With IE9 the TPage displays a "The webpage cannot be found" information message and the DocumentText property is blank. The OnLoad event does fire. The upload does not take place.

With the other browsers all works as per your instructions. In previous releases (prior to the TPgae modifications) IE9 has worked.

Make any sense?

Thanks - Mark
Mon, Jul 23 2012 1:29 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< My code simply uses a TFileUploadButton to select the file, then a call
to SubmitForm using a TPage as the output.

With IE9 the TPage displays a "The webpage cannot be found" information
message and the DocumentText property is blank. The OnLoad event does fire.
The upload does not take place.

With the other browsers all works as per your instructions. In previous
releases (prior to the TPgae modifications) IE9 has worked. >>

I'll have to check it out.  More than likely it has something to do with the
blank URL issue.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jul 23 2012 3:08 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

I'm not seeing this here with IE9 (I tried our formsubmit example project to
submit a file).  Can you send me the project that is having this issue ?

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jul 23 2012 3:44 PMPermanent Link

Mark Brooks

Slikware

Avatar

Tim - It's a very big project now, but the uploading is handled by an "upload form" which I show modally. The code in the upload form is copied below. It's really simple. Hope this helps and thanks for looking. Let me know if there's anything else you might need - Mark

//***************************************************************************************************************************
// SetFileToUpload
// Prepare a file that has been selected for upload
//***************************************************************************************************************************

procedure TfrmUpload.SetFileToUpload;
begin
 lblFilename.Caption := CastrumExtractFilename(btnSelect.Filename);
 btnUpload.Enabled := True;
end;

//***************************************************************************************************************************
// ClearFileToUpload
// Zap any file that may have been selected for upload
//***************************************************************************************************************************

procedure TfrmUpload.ClearFileToUpload;
begin
 btnSelect.Clear;
 lblFilename.Caption := 'No file selected';
 btnUpload.Enabled := False;
end;

//***************************************************************************************************************************
// UploadTo
// Prepare the form for uploading. This is called to show the form modally.
//***************************************************************************************************************************

procedure TfrmUpload.UploadTo(const AFolder: TCastrumFolder);
begin

 // Initialise the GUI

 fFolder := AFolder;
 Caption := 'Upload to ' + fFolder.Name;  
 ClearFileToUpload;

 // Initialise the submit parameters

 FormMethod := fmPost;
 FormEncoding := 'multipart/form-data';
 FormURL := CMConnection.APIURL + '/Folders/' + IntToStr(fFolder.Id) + '/Documents';

 // Show modally

 ShowModal;
end;

//***************************************************************************************************************************
// btnSelectChange
// A file has been selected for uploading
//***************************************************************************************************************************

procedure TfrmUpload.btnSelectChange(Sender: TObject);
begin
 SetFileToUpload;
end;

//***************************************************************************************************************************
// btnUploadClick
// Initiate the upload
//***************************************************************************************************************************

procedure TfrmUpload.btnUploadClick(Sender: TObject);
begin
 imgWaiting.Visible := True;
 btnUpload.Enabled := False;
 btnSelect.Enabled := False;
 btnClose.Enabled := False;
 SubmitForm;
end;

//***************************************************************************************************************************
// pgSubmitResultLoad
// The upload attempt is complete and the results page has been loaded
//***************************************************************************************************************************

procedure TfrmUpload.pgSubmitResultLoad(Sender: TObject);
begin
 
 // Need to check if visible because we seem to get a OnLoad event at startup

 if Self.Visible then
   begin
     ClearFileToUpload;
     btnClose.Enabled := True;
     btnSelect.Enabled := True;
     imgWaiting.Visible := False;
   end;
end;
Mon, Jul 23 2012 9:50 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< Tim - It's a very big project now, but the uploading is handled by an
"upload form" which I show modally. The code in the upload form is copied
below. It's really simple. Hope this helps and thanks for looking. Let me
know if there's anything else you might need - Mark >>

Hmm, I kind of need to establish a baseline comparison here.

How about this - can you get the formsubmit example project that comes with
EWB to work correctly with the file upload button ?  It uses an output page,
etc. and also works fine here with IE9.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jul 24 2012 5:46 AMPermanent Link

Mark Brooks

Slikware

Avatar

<<can you get the formsubmit example project that comes with
EWB to work correctly with the file upload button ?>>

Yup. This works fine. But I'm not sure that it's a good comparison since it's not really performing a file upload (sorry if I sound naive) and this is my specific scenario.

I have asked my colleague (who built our REST server) to see if there's a difference in my file upload submissions from IE (8 and 9) versus other browsers. He says there is a difference as follows:

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

IE is using

Content-Type: application/x-www-form-urlencoded

and doesn’t appear to be attaching the file content (the request length is only 19 bytes). The API rejects the request because it doesn’t see any file data being uploaded.

Whereas Chrome is using the correct content-type:

Content-Type: multipart/form-data; boundary=----WebKitFormBoundary2C679fZdGbJDyy04

with the base64 binary data bounded by the WebKitFormBoundary above. The content-length is 2046 bytes.

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

Additionally, I am getting an exception when trying to read DocumentText for the TPage from IE (8 or 9). The exception states "permission denied" at a specific line number. The line in question from the JavaScript is shown below:

webctrls_tpage.$p.tpage_getdocumenttext = function()
{
  var $t = this, $r;
  if ($t.tpage_floaded)
     $r = $t.tpage_fframe.contentDocument.documentElement.innerHTML; << THIS LINE >>
  else
     $r = "";
  return $r;
};

It seems as though innerHTML might not be accessible from IE?

Sorry to keep throwing these at you and thanks for your patience. File uploading is a very key part of our application and it's so close now.

Regards
Mark
Tue, Jul 24 2012 6:01 AMPermanent Link

Mark Brooks

Slikware

Avatar

Tim,

Interesting post from stack overflow on this topic that maybe has the solution:

http://stackoverflow.com/questions/6278750/enctype-multipart-form-data-works-different-between-ie9-and-chrome

Cheers
Mark
Tue, Jul 24 2012 4:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< Interesting post from stack overflow on this topic that maybe has the
solution:

http://stackoverflow.com/questions/6278750/enctype-multipart-form-data-works-different-between-ie9-and-chrome
>>

Yep, that's it - IE uses an "encoding" property instead of "enctype"
property.  MS should send everyone a check for all of the time they cause
everyone to waste on stupid stuff like this.

I'll upload a new build tonight that fixes this.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jul 24 2012 4:35 PMPermanent Link

Mark Brooks

Slikware

Avatar

<<I'll upload a new build tonight that fixes this.>>

Brilliant - thanks Tim
Tue, Jul 24 2012 4:39 PMPermanent Link

Mark Brooks

Slikware

Avatar

PS. Do you think this'll fix the "permission denied" issue when trying to read TPgae.DocumentText in IE?
Page 1 of 2Next Page »
Jump to Page:  1 2
Image