Thank you Andy, but it didn't worked 
Well, I think it's time to share some code. First I would like to enphasize that I'm not (anywhere in my code) starting a connection to the host or inserting the username or password that I have to have when I need to upload something manually to my ftp. I don't know if something like this is necessary and if it is, I have no idea about how I'm supposed to do that.
Also, I'm quire sure that the code is checking for the folders because if I use inside $targetDir something that doesn't exists, it will return an error right after the upload is finished.
So, first my header.php where I'm loading the plupload script:
<!DOCTYPE HTML>
<html lang="<?php echo $lang['htmlLang']; ?>" >
<head>
<meta charset="UTF-8">
<meta name="description" content="<?php echo $lang['slogan']; ?>" >
<title><?php echo $lang['publish']; ?></title>
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" type="text/css" href="assets/css/main.css">
<link rel="stylesheet" type="text/css" href="assets/scripts/sb/shadowbox.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<?php if (pageName() == 'contact.php') { echo ''?>
<script type="text/javascript" src="contact-form/js/jquery.form.js"></script>
<script type="text/javascript" src="contact-form/js/jquery.iphorm.js"></script>
<script type="text/javascript" src="contact-form/js/scripts.js"></script>
<?php } ?>
<?php if (pageName() == 'ftp.php') { echo ''?>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" />
<link rel="stylesheet" href="assets/css/jquery.ui.plupload.css" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="assets/scripts/gears_init.js"></script>
<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
<script type="text/javascript" src="assets/scripts/plupload.full.min.js"></script>
<script type="text/javascript" src="assets/scripts/jquery.ui.plupload.min.js"></script>
<script type="text/javascript">
// Convert divs to queue widgets when the DOM is ready
$( function() {
$("#uploader").plupload({
// General settings
runtimes : 'html5,flash,browserplus,silverlight,gears,html4',
url : 'uploader/upload.php',
max_file_size : '200mb',
max_file_count: 20, // user can add no more then 20 files at a time
chunk_size : '1mb',
unique_names : true,
multiple_queues : true,
// Resize images on clientside if we can
//resize : {width : 320, height : 240, quality : 90},
// Rename files by clicking on their titles
rename: true,
// Sort files
sortable: true,
// Specify what files to browse for
filters : [
{title : "webFiles", extensions : "jpg,png,gif"},
{title : "prepressFiles", extensions : "ai,pdf,tif,eps,ps"},
{title : "officeFiles", extensions : "txt,doc,docx,xls,xlsx"},
{title : "zipFiles", extensions : "zip"}
],
// Flash settings
flash_swf_url : 'assets/scripts/plupload.flash.swf',
// Silverlight settings
silverlight_xap_url : 'assets/scripts/plupload.silverlight.xap'
});
// Client side form validation
$('form').submit( function(e) {
var uploader = $('#uploader').plupload('getUploader');
// Validate number of uploaded files
if (uploader.total.uploaded == 0) {
// Files in queue upload them first
if (uploader.files.length > 0) {
// When all files are uploaded submit form
uploader.bind('UploadProgress', function() {
if (uploader.total.uploaded == uploader.files.length)
$('form').submit();
});
uploader.start();
} else
alert('You must at least upload one file.');
e.preventDefault();
}
});
});
</script>
<?php } ?>
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
And here is my upload.php file with some of my attempts:
<?php
/**
* upload.php
*
* Copyright 2009, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
// HTTP headers for no cache etc
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// Settings
//$targetDir = ini_get("clients_dir") . DIRECTORY_SEPARATOR . "plupload";
//$targetDir = ini_get("../clients_dir");
//$targetDir = $_SERVER["DOCUMENT_ROOT"].DIRECTORY_SEPARATOR."Web";
$targetDir = $_SERVER["DOCUMENT_ROOT"].DIRECTORY_SEPARATOR."Web/clients_dir";
$cleanupTargetDir = false; // Remove old files
$maxFileAge = 60 * 60; // Temp file age in seconds
// 5 minutes execution time
@set_time_limit(5 * 60);
// Uncomment this one to fake upload time
// usleep(5000);
// Get parameters
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
// Clean the fileName for security reasons
$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
// Make sure the fileName is unique but only if chunking is disabled
if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
$ext = strrpos($fileName, '.');
$fileName_a = substr($fileName, 0, $ext);
$fileName_b = substr($fileName, $ext);
$count = 1;
while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName_a . '_' . $count . $fileName_b))
$count++;
$fileName = $fileName_a . '_' . $count . $fileName_b;
}
// Create target dir
if (!file_exists($targetDir))
@mkdir($targetDir);
// Remove old temp files
if (is_dir($targetDir) && ($dir = opendir($targetDir))) {
while (($file = readdir($dir)) !== false) {
$filePath = $targetDir . DIRECTORY_SEPARATOR . $file;
// Remove temp files if they are older than the max age
if (preg_match('/\\.tmp$/', $file) && (filemtime($filePath) < time() - $maxFileAge))
@unlink($filePath);
}
closedir($dir);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
// Look for the content type header
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
if (isset($_SERVER["CONTENT_TYPE"]))
$contentType = $_SERVER["CONTENT_TYPE"];
// Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
if (strpos($contentType, "multipart") !== false) {
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
// Open temp file
$out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen($_FILES['file']['tmp_name'], "rb");
if ($in) {
while ($buff = fread($in, 4096))
fwrite($out, $buff);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
fclose($in);
fclose($out);
@unlink($_FILES['file']['tmp_name']);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
} else {
// Open temp file
$out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
if ($out) {
// Read binary input stream and append it to temp file
$in = fopen("php://input", "rb");
if ($in) {
while ($buff = fread($in, 4096))
fwrite($out, $buff);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
fclose($in);
fclose($out);
} else
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
// Return JSON-RPC response
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
?>