Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo Forum,

ich habe mit PHP eine seite geschrieben, mit der mehrere Bilder auf einmal hochgeladen werden sollen. Leider wird immer nur ein Bild hochgeladen. Folgend mein Code von seite 1:


$Counter = 0;
for ($i=0; $i<6; $i++)
{
echo "<input type='file' name='Picture[$i]'>";
}
[/PHP]

Code Seite 2:

[PHP]
for ($i=0; $i<6; $i++)
{
$Picture = $_FILES['Picture']['name']['$i'];
$TPicture = $_FILES['Picture']['tmp_name']['$i'];

if (is_uploaded_file($Picture))
if (move_uploaded_file($TPicture, $Picture))
echo "Bild hochgeladen";
}

Ich habe den Code auf das wesentliche gekürzt. Ich weiß einfach nicht wo mein Fehler ist. Es wird immer nur das letzet hinterlegte Bild hochgeladen.

Gruß aus Hanau

Patrick

Ich weiß einfach nicht wo mein Fehler ist.

1: echo "<input type='file' name='Picture[$i]'>";

2: $_FILES['Picture']['name']['$i'];

Müsste eher $_FILES["Picture$i"] heißen ;)

Und input name="Picture$i"

EDIT:

Oder du machst Picture generell zu einem Array, also als input name nur "Picture[]". $_FILES["Picture"] hat dann eben noch eine Dimension mehr... hab ich aber noch nicht so probiert, sollte aber gehen ($_FILES["Picture"][$i]['name'] z.B.)

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.