File: /var/www/content-sp/cron/transfer_image_between_local_folder.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//include("../wp-config.php");
global $wpdb;
echo "Source: " . $source = $_REQUEST['source'];
if ($source != '') {
if (isset($_POST['clicktocheck'])) {
print_r($_POST);
$image_name = $_REQUEST['image_name'];
if ($source == 'oly') {
$sourceFolder = '/uploads/tet_admin_photos_oly/';
$targetFOlder = '/uploads/tet_admin_photos_sp/';
// $OutPut = exec("/usr/bin/cp -ur /var/www/content-sp$sourceFolder$image_name /var/www/content-sp$targetFOlder");
// echo "<br>";
// echo "<pre>" . print_r($OutPut, true) . "</pre>";
} else if ($source == 'sp') {
$sourceFolder = '/uploads/tet_admin_photos_sp/';
$targetFOlder = '/uploads/tet_admin_photos_oly/';
// $OutPut = exec("/usr/bin/cp -ur /var/www/content-sp$sourceFolder$image_name /var/www/content-sp$targetFOlder");
// echo "<br>";
// echo "<pre>" . print_r($OutPut, true) . "</pre>";
}
}
} else {
echo "enter folder source";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Fetch Image From Content Server</title>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<style>
html,
body {
overflow-x: hidden;
}
body {
padding-top: 20px;
}
.text-white-50 {
color: rgba(255, 255, 255, .5);
}
.bg-purple {
background-color: #6f42c1;
}
</style>
</head>
<body style="background: #ececec;">
<main class="container">
<div class="d-flex align-items-center p-3 my-4 text-white bg-primary rounded shadow-sm">
<div class="row">
<div class="my-2" style="background: #0d6efd; margin-top: -30px !important; margin: -4px; border-radius: 5px; padding: 6px 18px 0px; width: 30%;">
<h1 class="h6 mb-0 text-white lh-1">Fetch Image</h1>
</div>
<div class="col-md-12">
<div class="col-md-12">
<form method="post">
<div class="input-group">
<label style="margin-right: 10px;">Content Folder Source</label>
<input type="text" name="image_name" id="image_name" class="form-control" placeholder="complete image name" value="" autocomplete="off" style="margin-right: 10px;">
<button type="submit" class="btn btn-secondary" name="clicktocheck">Fetch and Transfer</button>
</div>
</form>
</div>
<div class="col-md-3"></div>
</div>
</div>
</div>
</main>
<!-- footer -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<!-- footer -->
</body>
</html>