It's a long time since I used AMS but having some time on my hands I decided to come back to an old project to upload an image from my IP camera to my webspace with a name that I could then include in a static page. I'm almost there but after connecting to the FTP server it all works until the upload starts. It stops working and leaves the file correctly named but only 255 bytes in size. The upload finally throws an error message "Chunk: has too many syntax levels".
The whole thing as it stands - Button on click works perfectly:-
Page on timer event where the problem lies:-
I've tried both true and false for passive mode.
The whole thing as it stands - Button on click works perfectly:-
Code:
-- check if previous file still there and if so delete result = File.DoesExist("C:\\Users\\George\\Desktop\\grab.jpg"); if result then File.Delete("C:\\Users\\George\\Desktop\\grab.jpg", false, false, false, nil); end HTTP.Download("http://MYUSERNAME:[email protected]/cgi-bin/snapshot.cgi", "C:\\Users\\George\\Desktop\\grab.jpg", MODE_BINARY, 20, 80, nil, nil, nil); grabbed=true Page.StartTimer(1000, 10);
Page on timer event where the problem lies:-
Code:
-- belt and braces just double check that the image was grabbed if grabbed == true then FTP.Connect("ftp server URL", "MyUserName", "My Account Name", "My Account Name", false); -- turn passive mode on FTP.SetPassiveMode(false); FTP.ChangeDir("/htdocs/"); StatusDlg.Show(MB_ICONNONE, false); FTP.Upload("C:\\Users\\George\\Desktop\\grab.jpg", "grab.jpg", nil); StatusDlg.Hide(); grabbed = false FTP.Disconnect() end -- delete the image from desktop result = File.DoesExist("C:\\Users\\George\\Desktop\\grab.jpg"); if result then File.Delete("C:\\Users\\George\\Desktop\\grab.jpg", false, false, false, nil); end if grabbed == false then Application.Exit(); end
Comment