don victor Posted June 29, 2009 Share Posted June 29, 2009 Hi I am using a simple PHP script to copy files from a server to another server. The way I use it right now is not conveneit, becuase I go everytime and edit it and call in my broswer to get each file. <?php if(!copy("http://source.com/file.zip", "destination.zip")) { echo("failed to copy file"); } ; ?> could anyone help me make it like a form with a submit buttun, meaning I can just fill in a couple of planks and hit a submit key to do the process? by the way this script saves the file to the same directory it is in thanks in advance Link to comment https://forums.phpfreaks.com/topic/164116-small-script-help/ Share on other sites More sharing options...
patrickmvi Posted June 30, 2009 Share Posted June 30, 2009 You could just write a simple form that would look something like this: <form method="POST"> Source File: <input type="text" name="source"><br> Destination File: <input type="text" name="dest"><br> <input type="submit" value="Copy"> </form> Then you could change your code to read: <?php if(!copy($_POST['source'], $_POST['dest'])) { echo("failed to copy file"); } ; ?> You would have to make sure, however that this script is secured somehow as to not allow anybody to stumble on it and start downloading malicious scripts to your location. Link to comment https://forums.phpfreaks.com/topic/164116-small-script-help/#findComment-866329 Share on other sites More sharing options...
don victor Posted July 6, 2009 Author Share Posted July 6, 2009 thanks, but that would be two files, one HTML with the form and another PHP? where does the form refer to the PHP file? Link to comment https://forums.phpfreaks.com/topic/164116-small-script-help/#findComment-869478 Share on other sites More sharing options...
shergold Posted July 6, 2009 Share Posted July 6, 2009 do you mean how are the two files connected?, the form posts the data to the php file which is collected by the php file '$_POST[source]'. Link to comment https://forums.phpfreaks.com/topic/164116-small-script-help/#findComment-869482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.