Image Upload
| From: | Sascha Braun | Date: | Wed, 11 Sep 2002 12:31:48 +0000 |
| Subject: | Image Upload | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-115963@lists.php.net to get a copy of this message | ||
Hi Freaks,
I got a problem to solve. This script i wrote seems to have an failure but I don't know why.
The Error Message is telling me, that I don't have the permission to do the action I want to
do. I thought it has some to do with my windows apache installation, but on linux its the same
behavior.
if(!file_exists('../images/upload_tmp')) {
$dir = '../images/upload_tmp';
mkdir($dir);
chmod($dir, 07557);
$path = dirname($PATH_TRANSLATED).$dir.'/';
for ($i = 0; $i < 10; $i++) {
switch($i) {
case $i:
$source = $image[$i];
$source_name = $image_name[$i];
break;
}
if ($source <> "none") {
if ($error <> 1) {
$dest = $path.$source_name;
if (copy($source, $dest)) {
echo '<strong>'.$source_name-'</strong> wurde
hochgeladen<br>';
} else {
echo 'Schreibrechte im Zielverzeichnis fehlen<br>';
$error = 1;
}
}
@unlink($source);
}
}
} else {
echo 'Verzeichnis ist vorhanden';
}
If want the script to upload mulitple files, so the form is made like this:
<input name="image[]" type="file" class="formfield"
size="31">
Will this be working ?
Thanks