Jump to content

Small Script help!


don victor

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.