Array-Problem

borish

Mitglied
Array will keine Variablen anehmen

Hallo,
ich möchte ein Fileupload-Formular programmieren, bei welchem der Ziel-Ordner dynamisch generiert wird.

Der Aufbau ist folgendermaßen:

PHP:
<?php
session_start();
$imgordner = $_GET[imgordner];
$imgordner = str_replace( "/img/", "", $imgordner );

$ADMIN[RequirePass] = "No";   // Checks to see if upload has a vaild password
$ADMIN[Password] = "password";   // This is the password if the above option is Yes
$ADMIN[UploadNum] = "5";  // Number of upload feilds to put on the html page
$ADMIN[directory] = $imgordner;  // The directory the files will be uploaded to (must be chmoded to 777)
?>

Leider möchte das Script keine Variablen im Array aktzeptieren

wenn ich es so schreibe, dann schreibt er in den angegeben Ordner, aber ich möchte das der Ordner variabel ist.

PHP:
$ADMIN[directory] = "imgordner";  // The directory the files will be uploaded to (must be chmoded to 777)

Was mache ich falsch ?
 
Probier mal Folgendes:
PHP:
<?php

	session_start();

	if( is_array($_GET['imgordner']) ) {
		$imgordner = array();
		foreach( $_GET['imgordner'] as $key => $value ) {
			$imgordner[$key] = str_replace('/img/', '/', $value);
		}
	} else {
		$imgordner = $_GET['imgordner'];
	}

	$ADMIN['RequirePass'] = 'No';   // Checks to see if upload has a vaild password
	$ADMIN['Password'] = 'password';   // This is the password if the above option is Yes
	$ADMIN['UploadNum'] = 5;  // Number of upload feilds to put on the html page
	$ADMIN['directory'] = $imgordner;  // The directory the files will be uploaded to (must be chmoded to 777)

?>
ich hoffe, ich hab dich richtig verstanden.
 
Zurück