Hi Pascal!

Looks very interesting! I currently don't have anything going on with Ada
and Gnoga, but I'll take this for a spin when applicable.

Took a look at the example briefly, I think it looks good.

-Henrik

On Mon, Apr 13, 2020 at 12:01 PM Blady via Gnoga-list <
gnoga-list@lists.sourceforge.net> wrote:

>
> > Le 1 oct. 2019 à 10:40, Henrik Härkönen <hehar...@iki.fi> a écrit :
> > Hey!
> > Thanks Joakim for the super-quick reply! :)
> >
> > I'll take a look at the forms demo, thanks!
> >
> > I think the full page reload is just fine for now. Maybe if I get the
> other stuff to work as the way I intended, I might be interested in more
> fancy operation like ajax for it.
> >
> > -Henrik
> >
> > On Tue, Oct 1, 2019 at 11:10 AM Joakim Dahlgren Strandberg <
> joaki...@kth.se> wrote:
> > Hi Henrik,
> >
> > I am since yesterday working on the same issue, namely file upload.
> There is an example on how to do that in forms.adb which can be found in
> the demo directory. The application forms.adb demonstrates traditional post
> requests to the server forcing a full reload of the web page. But the
> example code there is good to get started.
> >
> > I have been experimenting with making AJAX request to the server by
> using the following approach (hopefully the code is inspirational, I would
> prefer sending a complete code example of forms.adb with the file upload
> without complete page refresh but it is more than a thousand lines of code
> and not suitable for e-mail):
> >
> > Gnoga.Server.Connection.Execute_Script
> >                  (ID     => Main_Window.Connection_ID,
> >                   Script =>
> >                     "var uploadRequest = new XMLHttpRequest();" &
> >                     "uploadRequest.open('post', window.location.href +
> 'demo');" &
> >                     "var file = document.getElementById('" &
> >                     Upload_File_Input.ID & "').files[0];" &
> >                     "var fd = new FormData();" &
> >                     "fd.append(""fn"", file);" &
> >                     "uploadRequest.send(fd);");
> >
> > However, trigggering file upload using XMLHttpRequest causes the
> uploaded file to be corrupted or bytes are missing in the resulting
> uploaded file. Hopefully somebody in the Gnoga mailing list has been more
> successful. Currently I do recommend uploading a file with complete page
> refresh as in forms.adb because it works.
> >
> > Best regards,
> >
> > Joakim
> >
> > Från: Henrik Härkönen <hehar...@iki.fi>
> > Skickat: den 1 oktober 2019 09:54
> > Till: Gnoga support list
> > Ämne: [Gnoga-list] File upload
> >
> > Hello!
> >
> > I'm not very experienced yet with Gnoga (or with Ada for that matter),
> but I was planning to make this little tool for the choir I'm singing in,
> which would involve the user to send a PDF files to the app and then it
> would do "things" with it and return some result file.
> >
> > How would one go about adding a file upload functionality with Gnoga? I
> browsed briefly through the API, but nothing related to it was caught by my
> eye.
> >
> > Best regards,
> > Henrik.
>
> Hello,
>
> I've added in Gnoga the support of Javascript FileReader API, see:
>
> https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/src/gnoga-client-files.ads
>
> I've added also a short example, it uploads the chosen file and puts its
> content in a text box, see:
> https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/test/files_ops.adb
>
> This version is in alpha status, thus it may change.
> All combination haven't been fully tested.
> Let me know if it is suitable for your needs.
> Moreover, feel free to send comments and change proposals.
>
> Regards, Pascal.
> https://blady.pagesperso-orange.fr
>
>
>
>
> _______________________________________________
> Gnoga-list mailing list
> Gnoga-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gnoga-list
>
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to