Cytat
<html>
<head>
<title>Formularz do przesyłania plików</title>
</head>
<body>
Proszę podać cztery pliki rysunków do przesłania:
<form action="upload_multiple.phtml" method="post" enctype="multipart/form-data">
Plik 1: <input type="file" name="thefiles[]"><br><br>
Plik 2: <input type="file" name="thefiles[]"><br><br>
Plik 3: <input type="file" name="thefiles[]"><br><br>
Plik 4: <input type="file" name="thefiles[]"><br><br>
<input type="submit" name="Submit" value="Wyślij">
</form>
</body>
</html>
Wydruk 5.5. Obsługa czterech przesyłanych plików
<?php
$aBasePath = dirname( $PATH_TRANSLATED );
for ( $nIndex = 0; $nIndex < count( $thefiles ); $nIndex++ )
{
if ( !empty( $thefiles_name[$nIndex] ) )
{
$aType = $thefiles_type[$nIndex];
if ( ( $aType == "image/gif" ) ||
( $aType == "image/pjpeg" ) ||
( $aType == "image/jpeg" ) )
{
$aNewName = $aBasePath . "/uppics/" .
$thefiles_name[$nIndex];
copy( $thefiles[$nIndex], $aNewName );
$aNewNames[] = $thefiles_name[$nIndex];
}
}
}
?>
<html>
<head>
<title>Wyświetlanie przesłanego rysunku</title>
</head>
<body>
<?php
$aCount = count( $aNewNames );
print( "Przesłano <b>$aCount</b> rysunki:<br><br>" );
foreach( $aNewNames as $aNewName )
{
print("<img src=\"uppics/$aNewName\" border=\"0\"><br><br>");
}
?>
</body>
</html>
<head>
<title>Formularz do przesyłania plików</title>
</head>
<body>
Proszę podać cztery pliki rysunków do przesłania:
<form action="upload_multiple.phtml" method="post" enctype="multipart/form-data">
Plik 1: <input type="file" name="thefiles[]"><br><br>
Plik 2: <input type="file" name="thefiles[]"><br><br>
Plik 3: <input type="file" name="thefiles[]"><br><br>
Plik 4: <input type="file" name="thefiles[]"><br><br>
<input type="submit" name="Submit" value="Wyślij">
</form>
</body>
</html>
Wydruk 5.5. Obsługa czterech przesyłanych plików
<?php
$aBasePath = dirname( $PATH_TRANSLATED );
for ( $nIndex = 0; $nIndex < count( $thefiles ); $nIndex++ )
{
if ( !empty( $thefiles_name[$nIndex] ) )
{
$aType = $thefiles_type[$nIndex];
if ( ( $aType == "image/gif" ) ||
( $aType == "image/pjpeg" ) ||
( $aType == "image/jpeg" ) )
{
$aNewName = $aBasePath . "/uppics/" .
$thefiles_name[$nIndex];
copy( $thefiles[$nIndex], $aNewName );
$aNewNames[] = $thefiles_name[$nIndex];
}
}
}
?>
<html>
<head>
<title>Wyświetlanie przesłanego rysunku</title>
</head>
<body>
<?php
$aCount = count( $aNewNames );
print( "Przesłano <b>$aCount</b> rysunki:<br><br>" );
foreach( $aNewNames as $aNewName )
{
print("<img src=\"uppics/$aNewName\" border=\"0\"><br><br>");
}
?>
</body>
</html>
I chodzi o to że wyskakuje mi bład i nie daje obrazków na serwer możecie powiedzieć dlaczego zresztą sami sobie sprawdźcie a wyglada wszystko pieknie i ładnie