From the little information you gave us, my guess is that your problem lies within the following code:
$_FILES['uploadFile' . $i]
Try this instead and see if it works:
$filesUploaded = Upload('uploadFile', './media/files/');
foreach ($filesUploaded as $fileUploaded)
{
$res = db_res("INSERT INTO `atest` SET `filename` = '" . $fileUploaded . "', `article` = '$ArticleUri';");
}
Here is the Upload()
function you're gonna need:
function Upload($source, $destination)
{
$result = array();
if (array_key_exists($source, $_FILES) === true)
{
if (is_array($_FILES[$source]['error']) === true)
{
foreach ($_FILES[$source]['error'] as $key => $value)
{
if ($value == UPLOAD_ERR_OK)
{
$filename = str_replace("'", '', stripslashes(basename($_FILES[$source]['name'][$key])));
if (move_uploaded_file($_FILES[$source]['tmp_name'][$key], $destination . $filename) === true)
{
$result[] = $destination . $filename;
}
}
}
}
else
{
$filename = str_replace("'", '', stripslashes(basename($_FILES[$source]['name'])));
if (move_uploaded_file($_FILES[$source]['tmp_name'], $destination . $filename) === true)
{
$result[] = $destination . $filename;
}
}
}
return $result;
}
Printing the $_FILES
array would be very useful for us to find possible bugs in your code:
echo '<pre>';
print_r($_FILES);
echo '</pre>';
PS: Don't forget your SQL query is vulnerable to SQL Injections!