Jump to content

How return file from unigui server and read property in javascript1ю?


altagur

Recommended Posts

Excuse me for a questions.

 

I. In dragdrop i am return file url to brouser.

 

 

function dragStart(evt)
{
  var fName = MyForm.MyLabel.Text;
  files = "image/jpeg:"+fName+":"+document.location+"/temp/"+fName;
  event.dataTransfer.setData("DownloadURL",files);
  return true;
}

 

Then dragdrop started file not exists because he is in database field and download file in dragdrop start not rooles.

 

Pleas answer stuped-me how in unigui capture  file request (localhost:8077/temp/myfile.jpg) for file creating and returning file dynamicallyю

 

2 Secondary question - in dragdrop start i need know filename Now i create TLabel put in caption filename field value from database then cursor moved and get file name as MyForm.MyLabel.text

 

Invisible components like TQuery or TDataset can be visible in javascript client events. I need database field values in javascript. Or need create custom control! create publushed property for example CurValue and get file name as MyForm.MyGrid.CurValue, i am reall sorry for my bad english.

 

 

Possible create standart TUniDatasource object with method FieldValue("FieldName") visible in client side like javascript object?

(Ajax request is delayed and javascript work in one thread because impossible call ani funnction in javascript and give result from server (getTimeout is complex way by me ). But standart prepared values will be useful i think)

 

 

Can i obtain IdHTTPServer in unigui such as

 

procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
...

File prepare;
IdHTTPServer1.ServeFile(AThread,AResponseInfo,'path to file');
...
end;

 

 

 

Thank you for any help.

Gurov Nick

Link to comment
Share on other sites

Is exist legal recomended method  of unigui for returning files dinamically created on file request??

 

such as localhost:8077/files/myfile.jpg  or i need only to rewrite sources if indy DoComandGet? Where in unigui write  code like:

 

procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
...

File prepare;
IdHTTPServer1.ServeFile(AThread,AResponseInfo,'path to file');
...
end;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...