My client is clueless. It sends 4MB photos to the system, and complains about the speed.
I'm thinking of using Cloudinary to solve this problem. There are libraries for PHP in the documentation. But I'm not really good at using the service.
Has anyone used and can give me some guidance on this implementation?
In my current one, I'd say this way:
<?php
header('Access-Control-Allow-Origin: *');
// ESTE ARQUIVO DEVE ESTAR EM admin/vovos/_lib/file/img E SETADO EM CADASTRPDELICIAS_CONTROLLER
$target_path = "app_img/";
$target_path = $target_path . basename( $_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo "Upload and move success";
} else{
echo $target_path;
echo "There was an error uploading the file, please try again!";
}
?>
I changed my PHP to:
<?php
header('Access-Control-Allow-Origin: *');
require 'Cloudinary.php';
require 'Uploader.php';
require 'Api.php';
\Cloudinary::config(array(
"cloud_name" => "meu_name",
"api_key" => "meu_key",
"api_secret" => "meu_secret"
));
$target_path = \Cloudinary\Uploader::upload("http://res.cloudinary.com/ramosinfo/app_img/");
\Cloudinary\Uploader::upload($_FILES["file"]["tmp_name"]);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo "Upload and move success";
} else{
echo $target_path;
echo "There was an error uploading the file, please try again!";
}
?>
As documentation, but still unable to send ...