I'm not sure it is a bug or my mistake, but the following behavior is suspicious:
in the attached project I wanted to read (later process) ZGE wiki pages. It uses WebOpen component several times, each time for one defined page. At the moment it has 2 pages defined. The application works correctly if started the first time in Preview (Alt+Enter). If started the second time, it reads just one page, and if started 3rd and more times, it does not read any page.
After some more tests I observed that the problem is not in WebOpen component itself, but in recursion of activation the same WebOpen component from its own OnResult section. This recursion is has probably some side effects causing the undesired behavior. In meantime I have another version of the project without recursion, which works fine.
Problem with WebOpen
Moderator: Moderators
Problem with WebOpen
- Attachments
-
- ZgeHelp.zgeproj
- ZGE project
- (1.33 KiB) Downloaded 672 times
Continuing with the idea of creating ZGE help from wiki pages, I would like to use WebOpen component also for downloading pictures (and maybe also other kind of binary files). I know, the original idea of WebOpen was different, but maybe its extension would not be very difficult.
The idea is to download a binary file from WebOpen.Url and put its content to the specified byte array WebOpen.ResultArray which can be saved to a local file by means of the File component.
At the moment, the WebOpen does not change the content of the specified WebOpen.ResultArray and the WebOpen.ResultString contains just first characters of the picture content (for instance, "‰PNG" for .png).
The attached project file contains an example of how I would like to use the WebOpen and File components.
The idea is to download a binary file from WebOpen.Url and put its content to the specified byte array WebOpen.ResultArray which can be saved to a local file by means of the File component.
At the moment, the WebOpen does not change the content of the specified WebOpen.ResultArray and the WebOpen.ResultString contains just first characters of the picture content (for instance, "‰PNG" for .png).
The attached project file contains an example of how I would like to use the WebOpen and File components.
- Attachments
-
- DownloadPicture.zgeproj
- ZGE project
- (709 Bytes) Downloaded 682 times
Hi Rado1,
In case you don't want to wait you could use a Array that is big enough to fit the largest file you want to support and a simple PHP script to determine the file-size. For instance ..
.. that you then query using something like "http://www.mysite.com/getfilesize.php?u ... /image.png". Alternatively you could simply use the WinINet functions directly.
But i'm sure Ville will fix it soon
K
In case you don't want to wait you could use a Array that is big enough to fit the largest file you want to support and a simple PHP script to determine the file-size. For instance ..
Code: Select all
$header = get_headers($_GET['url'], 1);
echo $header['Content-Length'];
But i'm sure Ville will fix it soon

K