CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Error msg: The file can not be returned by server!

by ScottWGast » 17 Dec 2015 20:41

I receive this message when I attempt to download a file using JQFileDownload:

... raised exception class EIWCGJQuery with message "The file can not be returned by server!".

This error occurs only after I open a TIWCGJQDialog by clicking a TIWCGJQButton with an async event.

Once I close the dialog and click on the TIWLink, . it attempts to execute this line from the DownLoadLinkedDocument procedure:
Self.fileDownload.DownloadFileName(strTo)

Circumstances:
I insert a TIWLink into my grid so that I have somewhere to click and download the file. This code shows the creation of the TIWLink component and setting the various properties:

<snip>
if not Assigned(Cell[Row,3].Control) then
begin
Cell[Row,3].Control := TIWLink.Create(Self);
TIWLink(Cell[Row,3].Control).Name := 'LinkedDocumentLink' + S2Snax.IntegerToString(ID);
end;
TIWLink(Cell[Row,3].Control).Caption := FileName;
TIWLink(Cell[Row,3].Control).Tag := ID;
TIWLink(Cell[Row,3].Control).OnAsyncClick := Self.ContactLinkedDocumentLinkAsyncClick;
<snip>

Here is the async click event code:

procedure TformContactEdit.ContactLinkedDocumentLinkAsyncClick(Sender: TObject; EventParams: TStringList);
begin
Self.DownLoadLinkedDocument(TIWLink(Sender).Text);
end;

Here is the procedure called from inside the async event:

procedure TformContactEdit.DownLoadLinkedDocument(Filename: String);
var
strFrom, strTo: String;
begin
strFrom := UserSession.SharedDocumentDirectory + S2Snax.IntegerToString(Self.ContactID) + PATHDELIM + Filename;
strTo := UserSession.UserTempDir + Filename;
CopyFile(PChar(strFrom), PChar(strTo), False);

if FileExists(strTo) then
Self.fileDownload.DownloadFileName(strTo)
else
WebApplication.ShowMessage('Error: Unable to locate file - ' + strTo);

end;
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 22 Dec 2015 13:28

Hello Scott

Sorry for the delay.

The support rules are easy to define. Or you can demonstrate the issue using a test case, or we've to run a remote session, to understand the problem, among the complexity of the application.

But unfortunatelly we cannot afford to make remote sessions that could take more than an hour, except if the user compensates with our affordable* premium support.

I hope we can all understand.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by assapan » 24 Dec 2015 17:10

Hi Scott,
Are you using IIS ? if so are you sure IIS has rights to your folder ?
Want to visit Ardeche http://leclosdelarc.fr/index.php
The Pont d’Arc Cavern http://en.cavernedupontdarc.fr
Image
User avatar
assapan
 
Posts: 600
Joined: 16 Dec 2013 12:04
Location: France

by ScottWGast » 29 Dec 2015 17:46

Hey assapan,

Yes I'm using IIS and it has full access to the folder(s) in question. The only difference is that I have been attempting to modify my code to utilize 100% Async events. This is when the error started.
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 30 Dec 2015 15:35

Hello Scott

Does the Self.fileDownload.DownloadFileName(strTo) works for you in a sample app?
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQFileDownload

Who is online

Users browsing this forum: No registered users and 3 guests

Contact Us.