Max image size in mijn code
op dit moment heb ik dit:
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
29
30
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
29
30
<?php
$new_file_name[0]="01.jpg";
$new_file_name[1]="02.jpg";
$new_file_name[2]="03.jpg";
$path1= $upload_dir.$new_file_name[0];
$path2= $upload_dir.$new_file_name[1];
$path3= "upload/".$new_file_name[2];
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3);
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][0]."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][0]."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][0]."<BR/>";
echo "<img src=\"$path1\" width=\"140\" height=\"35\">";
echo "<P>";
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][1]."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][1]."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][1]."<BR/>";
echo "<img src=\"$path2\" width=\"54\" height=\"35\">";
echo "<P>";
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][2]."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][2]."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][2]."<BR/>";
echo "<img src=\"$path3\" width=\"624\" height=\"407\">";
?>
$new_file_name[0]="01.jpg";
$new_file_name[1]="02.jpg";
$new_file_name[2]="03.jpg";
$path1= $upload_dir.$new_file_name[0];
$path2= $upload_dir.$new_file_name[1];
$path3= "upload/".$new_file_name[2];
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3);
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][0]."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][0]."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][0]."<BR/>";
echo "<img src=\"$path1\" width=\"140\" height=\"35\">";
echo "<P>";
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][1]."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][1]."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][1]."<BR/>";
echo "<img src=\"$path2\" width=\"54\" height=\"35\">";
echo "<P>";
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][2]."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][2]."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][2]."<BR/>";
echo "<img src=\"$path3\" width=\"624\" height=\"407\">";
?>
Ik ben best nieuw met php en snap nog niet helemaal waar en hoe ik daar na een max size bij moet parkeren.
Alsvast bedankt.
$HTTP_POST_FILES is ernstig verouderd, dit mag je veranderen in $_FILES.
Om de breedte en hoogte te bepalen:
Code (php)
1
2
3
4
2
3
4
<?php
$breedte = imagesx($_FILES['ufile']['tmp_name']);
$hoogte = imagesy($_FILES['ufile']['tmp_name']);
?>
$breedte = imagesx($_FILES['ufile']['tmp_name']);
$hoogte = imagesy($_FILES['ufile']['tmp_name']);
?>
Vergeet niet dat deze functies alleen op plaatjes werken, dus je moet wel eerst controleren of het geuploade bestand ook daadwerkelijk een afbeelding is.
Gewijzigd op 01/01/1970 01:00:00 door Bo az
Bedankt mensen hier heb ik denk ik wel wat aan! Ga er meteen maar ff mee aan de slag thanks