View Full Version : is this possible?
ianhull
08-22-2004, 12:43 PM
Would I beable to copy a file from a local machine and send it to a ftp server?
If this can be done can anyone please point me in the right direction
Thanks
eric_darling
08-22-2004, 04:26 PM
Check out the FTP Plugin for AMS 5 (http://www.indigorose.com/ams/all_add_ons.php?showItem=42&itemLimit=25&itemIndex=0&sortBy=name&sortOrder=ASC). You need the Pro version, but it's pretty easily implemented.
ianhull
08-23-2004, 04:05 AM
I have already purchased the FTP Plugin but was wondering if it was possible to send a file to a FTP server without any prompt.
My project is a questionaire which records button clicks and stores the result in a .txt file. at the end of the questionaire the user will be shown the results from the .txt file but I would also like to send the file to a server for administration viewing.
Can anyone here help me achieve this?
Thanks.
John-oh
08-23-2004, 04:54 AM
Check out the FTP example, that came with the Plugin.
I suggest you would need :
FTP.Connect(strHostname, strUsername, strPassword);
and a
FTP.Upload(strSourceFile, strDestFile);
at a minimum, but just pick out the bits you need from the example.
I guess you would need to append some sort of unique identifier to the file names to avoid overwrites.
J
ianhull
08-23-2004, 01:40 PM
Thanks for that.
I will have a look.
Corey
08-23-2004, 02:01 PM
Well the FTP pluin is definitely the best way to do this. You can do it without any system prompts, but the user's firewall is probably going to prompt them for access permission. That is going to be the same no matter which method you use. You can submit files via http using a simple upload form, but not without prompting the user. File fields in HTTP forms cannot be auto-filled because of a built in security feature. (in Javascript I assume)
That all being said. Be aware, Windows has a built in FTP client. You can use it manually by going to START > RUN typing in "FTP", then press enter. You can use this FTP client to connect, upload, download, disconnect, etc. You can do this without prompting the user by containing your FTP commands in a simple text script and then referring to that script via a batch file. Tons of stuff on Google about this method, it's very easy to do. ***BUT NOT SECURE***. Your password data will be readily visible to the end user. You can protect it somewhat, you can even compile your batch file, but at the end of the day, the FTP script is plain text and, whether or not you write/delete it dynamically or have it static, the connection data is exposed at some point in the chain. Also, with the FTP client you can run it minimized but if your end user catches site of that minimized console window somehow, they are not likely to feel very secure about your software. Typical computer users will blanch pure white if they see a console window suddenly pop up and disappear.
So, that's why I reccomend the FTP plugin. It's the quickest, easiest, cleanest way to do this. Can't beat it. It's not SS2 though, so it's not 100% secure either, but it's much, much more secure than a batch file... :)
Hope that shines some light on the topic for you. :)
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
ianhull
08-23-2004, 02:44 PM
yeah it does thanks Corey.
I didn't think about firewalls and things.
I suppose I can have the user decide whether to send the info or not via a button.
I have tried to use this code on the onshow event but then my AMS Projects closes.
Any ideas why?
FTP.Connect("ftp.mysite.com", "myusername", "mypassword", "", true);
result = FTP.IsConnected();
FTP.SetTransferType(FTP.AUTO);
FTP.Upload("C:\\myfile.txt", "myfile.txt", nil);
Hope you can help
Thanks.
ianhull
08-23-2004, 02:52 PM
Corey do you have any information on sending it to a email address?
I suppose it doesn't matter how they get it as long as they do.
I have read a few posts on sending attatchments but I have not yet grasped it.
If you could point me in the right direction i would very much appreciate it.
thanks
Ian
Corey
08-23-2004, 02:53 PM
Hi. Seems like the result = FTP.IsConnected(); isn't being used, so it's unneeded. I'm no expert on the FTP plug, Lorne or Mark are more up on that, but I think it might be because you need to set the remote directory, i.e.:
FTP.ChangeDir("/var/www/html");
Or whatever your "path to upload directory" is.
One more idea is email, if it's just a little text, that would work. Or, and this is probably the ultimate solution, simply pass the text value to a PHP script and enter it in a MySQL database. If I were doing this, I think that's how I would do it. So:
1. As the test finishes, an HTTP submit action sends the text to the server. You can use encrypted password access here if you like, or not.
2. A tiny remote script inserts that text data into a remote (MySQL in my case) database.
If you need a PHP/MySQL equipped host, http://www.tera-byte.com has hosting accounts for $9 per month which have full PHP/MySQL, tons of storage space and bandwidth, and a zillion other bells and whistles. The Tera-byte 4U account is da bomb. You can prepay the year for under $100. :yes
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.