I'm trying to move/copy/upload an image from tmp directory to another directory using following code, but I don't see my image being moved/copied to the destination. Is there any alternative?
public function uploadToS3($file, $tmp_url) {
if (strrpos($file, '.tmp') == strlen($file)-4) {
$file = substr($file, 0, strlen($file)-4);
}
$destination = "var/www/html/image" . $file;
if (file_exists($destination)) {
echo 'File '. $destination. ' already exists!';
} else {
move_uploaded_file($tmp_url, $destination);
}
}
//Ex: $tmp_url = http://localhost/mage/media/tmp/catalog/product/s/c/abc.png
//Ex: $destination = /var/www/html/image/s/c/abc.png
Following comments below I've tried following php code which fails too
<?php
$tmp_url = "var/www/html/abc/abc.png";
$destination = "var/www/html/des/abc.png";
if(move_uploaded_file($tmp_url, $destination)){echo "success";}else{echo "fail";}
uploadToS3??