Skip to content
Snippets Groups Projects
Commit 0315195d authored by Armand Bahi's avatar Armand Bahi
Browse files

Upload multiple files 1

parent df262cf7
Branches
Tags
No related merge requests found
......@@ -58,31 +58,38 @@ if (!empty($boundary)) {
// handle your fields here
// Ce champ est un fichier ()?
if (!empty($filename)) {
// Internet Explorer passe le chemin complet vers le fichier.
$aFilenamePathInfo = pathinfo($filename);
$filename = $aFilenamePathInfo['filename'] . '.' . $aFilenamePathInfo['extension'];
//
// Multiples documents
if (substr($name, -2) == '[]') {
$_FILES[substr($name, 0, -2)][] = array(
"file" => substr($body, 0, strlen($body) - 2),
"name" => $filename
);
}
// Documents simples
else {
$_PUTDATA[$name . "_file"] = substr($body, 0, strlen($body) - 2);
$_PUTDATA[$name . "_name"] = $filename;
} else
// Utilisation de $_FILES
$_FILES[$name] = array(
"file" => substr($body, 0, strlen($body) - 2),
"name" => $filename
);
}
} else {
$_PUTDATA[$name] = substr($body, 0, strlen($body) - 2);
/*
switch ($name) {
// this is a file upload
case 'userfile':
file_put_contents($filename, $body);
break;
// default for all other files is to populate $data
default:
$_PUTDATA[$name."_file"] = substr($body, 0, strlen($body) - 2);
$_PUTDATA[$name."_name"] = $filename;
break;
}
*/
}
}
}
error_log('$_POST: '. print_r($_POST, true));
error_log('$_FILES: '. print_r($_FILES, true));
$aParamsJson = json_decode(file_get_contents('php://input'), true);
if ($_PUTDATA != null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment