meerdere-bestanden-uploaden
Gesponsorde koppelingen
PHP script bestanden
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?
function uploadimage ($files, $tid)
{
sort($files);
for ($i = 0; $i < count($files); $i++)
{
if (is_uploaded_file($files[$i]['tmp_name']))
{
if (!file_exists("uploads/" . $tid))
{
if (chmod(mkdir("uploads/" . $tid), 0777))
$result['dir'] = "Dir creation and chmod ok!";
}
if (file_exists("uploads/" . $tid . "/" . date('YmdHis') . ".jpg"))
$filename = date('YmdHis') + rand(0, 100000);
else
$filename = date('YmdHis');
if (move_uploaded_file($files[$i]['tmp_name'], "uploads/" . $tid . "/" . $filename . ".jpg"))
$result['filename'] = "uploads/" . $tid . "/" . $filename . ".jpg";
}
}
return $result;
}
?>
function uploadimage ($files, $tid)
{
sort($files);
for ($i = 0; $i < count($files); $i++)
{
if (is_uploaded_file($files[$i]['tmp_name']))
{
if (!file_exists("uploads/" . $tid))
{
if (chmod(mkdir("uploads/" . $tid), 0777))
$result['dir'] = "Dir creation and chmod ok!";
}
if (file_exists("uploads/" . $tid . "/" . date('YmdHis') . ".jpg"))
$filename = date('YmdHis') + rand(0, 100000);
else
$filename = date('YmdHis');
if (move_uploaded_file($files[$i]['tmp_name'], "uploads/" . $tid . "/" . $filename . ".jpg"))
$result['filename'] = "uploads/" . $tid . "/" . $filename . ".jpg";
}
}
return $result;
}
?>