Hi,
i´ve created a little stack and two livecode server scripts that allow to upload a file to a web server running livecode server version 8 or higher.
After successful upload the download url of the uploaded file is copied to the clipboard for sharing purposes. The stack has a little filemanager included which allows to get the d/l url for older uploaded files and it allows also to delete older files which are not needed anymore
The stack uses Bernd Niggeman´s Gauge widget for showing the upload progress. See his post about this really cool widget http://forums.livecode.com/viewtopic.ph ... ge#p154776
There are only minimal adjustments needed in the stack script of the livecode stack to get it running with your web server.
The archive contains the livecode stack, 2 livecode server scripts, the .lcb file for the Gauge widget, an installation guide for the Widget and a readme file.
I´ve tested it with Livecode 8.1.4 and Livecode server 8.1.2.
Please read the file PLEASE Read Me First!.txt first.
Hope it´s of some use for the one or the other
Unfortunately the zip archive is 452kb in size and the forum does only allow attachments with a size up to 256kb.
Therefore please find the archive here http://dl.qck.nu/?dl=DropUpload.zip
Matthias
Sample stack and lc server scripts for uploads to lc server
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Sample stack and lc server scripts for uploads to lc server
Last edited by matthiasr on Mon Jun 12, 2017 4:51 pm, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Sample stack and lc server scripts for uploads to lc ser
Super cool. Thanks for posting that.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: Sample stack and lc server scripts for uploads to lc ser
As the stack only runs with LC 8.1.4, because of the widget, i decided to make some changes to the stack, so it can be used either with the widget (LC 8.1.4) or with a scrollbar (any LC8 or 9).
If you want to use the stack with a scrollbar instead of the widget, then just delete the gauge widget on the card "main" and run the following command in the message bo
dispatch "setupProgressObject" to stack "DropUpload" This makes the scrollbar and a background image visible.
If you later decide to use the widget instead of the scrollbar, just add the gauge widget to the stack (don´t care about position or size) , make sure its name is "gauge" and run the above command again.
This then hides the scrollbar and the background image and moves the widget into its correct position and makes also some changes to the widget (size and display options).
The link is still the same:
https://dl.qck.nu/?dl=DropUpload.zip
Matthias
If you want to use the stack with a scrollbar instead of the widget, then just delete the gauge widget on the card "main" and run the following command in the message bo
dispatch "setupProgressObject" to stack "DropUpload" This makes the scrollbar and a background image visible.
If you later decide to use the widget instead of the scrollbar, just add the gauge widget to the stack (don´t care about position or size) , make sure its name is "gauge" and run the above command again.
This then hides the scrollbar and the background image and moves the widget into its correct position and makes also some changes to the widget (size and display options).
The link is still the same:
https://dl.qck.nu/?dl=DropUpload.zip
Matthias
-
- VIP Livecode Opensource Backer
- Posts: 348
- Joined: Sun Jul 03, 2011 2:04 am
- Location: Gulf Breeze, Florida
Re: Sample stack and lc server scripts for uploads to lc server
Hello,
This is a really great example; thanks for sharing. I am only just beginning to experiment with the tsNet capabilities myself. By the way... Is there a way to cancel uploads while in progress? I see "tsNetClose" and "tsNetCloseConn" in the dictionary, but I'm not having much success playing with them.
Thanks!
- Boo
Gulf Breeze, Florida
This is a really great example; thanks for sharing. I am only just beginning to experiment with the tsNet capabilities myself. By the way... Is there a way to cancel uploads while in progress? I see "tsNetClose" and "tsNetCloseConn" in the dictionary, but I'm not having much success playing with them.
Thanks!
- Boo
Gulf Breeze, Florida
-
- VIP Livecode Opensource Backer
- Posts: 348
- Joined: Sun Jul 03, 2011 2:04 am
- Location: Gulf Breeze, Florida
Re: Sample stack and lc server scripts for uploads to lc server
Hi Again,
Okay; you can use tsNetPost to upload asynchronously and cancel the upload with tsNetCloseConn and a custom connection ID.
In Matthias' code, you can use:
I also got it working with a progress bar utilizing a send handler to update the progress accordingly...
Cool stuff. (And still playing around with it.)
Cheers,
- Boo
Gulf Breeze, Florida
Okay; you can use tsNetPost to upload asynchronously and cancel the upload with tsNetCloseConn and a custom connection ID.
In Matthias' code, you can use:
Code: Select all
get tsNetPost(pConnectionID, tURL, pHeaders, line 2 to -1 of sFormData, pCallback, pSettings)
Cool stuff. (And still playing around with it.)
Cheers,
- Boo
Gulf Breeze, Florida