I am trying to find a simple script to upload some php files to my webserver.

I do not have ftp access over than via a GUI for the provider which sucks, I have a script running on my local server to make some file changes, I then want to put those files onto my remote server so users can see the updated info.

Does anyone know of a way I can do this that wont involve scripting an fwrite with multiple lines as there will be several pages and several hundred lines to copy.

Member Avatar for girishpadia

Hi,
use following function.

function UploadOne($fname)
{
if (is_uploaded_file($fname))
{
$filname = $curtime."_".basename($fname);
$uploadfile = $uploaddir . $curtime."_".basename($fname);
$copyfile = $copyfile . $curtime."_".basename($fname);
if (move_uploaded_file ($fname, $uploadfile))
{
$res = "File has been successfully uploaded and stored.<br>";
}
else
$res = "Could not move ".$fname." to ".$uploadfile."<br>";
}
else
$res = "File ".$fname." failed to upload.";
return ($res);
}

Call this function and send a filename with path as parameter.

I am trying to find a simple script to upload some php files to my webserver.

I do not have ftp access over than via a GUI for the provider which sucks, I have a script running on my local server to make some file changes, I then want to put those files onto my remote server so users can see the updated info.

Does anyone know of a way I can do this that wont involve scripting an fwrite with multiple lines as there will be several pages and several hundred lines to copy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.