• 26.08.2025, 09:41
  • Registrieren
  • Anmelden
  • Sie sind nicht angemeldet.

 

Eumel

God

PHP Problem

Freitag, 9. April 2004, 12:01

Quellcode

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
  if($was=="doit")
  {
    $size = $bild_size; // Größe der Datei 
    $name = $bild_name; // Der Originalname 
    $type = $bild_type; // Der MIME Type der Datei 
      
    if(eregi("(txt&#124;map)$",$name))
      {
        if(file_exists("../../files/&name"))
        {
          echo "File already exists!.";
        }
        else if($size<2000000 AND $size!=0)
        { 
          copy($bild,"../../files/$name"); // Kopiert das Bild
        
            echo "Your file was uploaded successfully!<br>"; 
        echo "Size: ".$size." Byte<br>"; 
        echo "Name: ".$name."<br>";
        
      echo "MIME-Type: ".$type."<br>";
      echo "Ansehen: <a href=../../files/$name>".$name."</a>";  
      }
        else
        { 
        echo "Your file is bigger than 2.000.000 bytes or equal 0 bytes or already there.";  
      } 
    }
      else
      { 
      echo "Invalid file: ".$name; 
    } 

  }
  else
  { 
    echo "<form action='".$PHP_SELF."' enctype=\"multipart/form-data\" method='post'>"; 
    echo "<input type='hidden' name='was' value='doit'>"; 
    echo "<table>"; 
    echo "<tr>"; 
      echo "<td>File: </td>"; 
      echo "<td><input type='file' name='bild'></td>"; 
    echo "</tr><tr>"; 
      echo "<td> </td>"; 
      echo "<td><input type='submit' value='Upload'></td>"; 
    echo "</tr>"; 
    echo "</form></table>"; 
  } 
?>


Warum zum Geier überschreibt der immernoch Dateien beim Hochladen? Das ist doch eine file_exists-if-anweisung ?!

Ich seh da nich mehr durch ^^

MfG
"I've always said, the Web is the sum of all human knowledge plus porn.", Ron Gilbert
UltraStar Manager 1.7.2 | Infos zu meinem PC | .o0 DeathSpank 0o.

PAB

God

Re: PHP Problem

Freitag, 9. April 2004, 12:11

Zitat

if(file_exists("../../files/&name"))

Kleiner Tippfehler

sliP

Junior Member

Re: PHP Problem

Freitag, 9. April 2004, 12:24

leiten wir variablen neuerdings mit & ein ?! :D Mach nen $ davor dann klappts auch ^^
$i = 1; for ($i =1; $i =2; $i++) { echo "wait; for $life"; break; } ... ... ... --------------------------------------------- Suche noch jemanden der alte AC Teile für wenig Geld auf Lager hat und loswerden will. Einfach mal an mich schreiben. Vielen Dank im Voraus

Eumel

God

Re: PHP Problem

Freitag, 9. April 2004, 17:41

Danke! :D

Hab ich ne Möglichkeit, aus dem "Durchsuchen..." ein "Browse..." zu machen?

http://www.sod-bf1942.de/ftf/content/upload/upload.php

MfG
"I've always said, the Web is the sum of all human knowledge plus porn.", Ron Gilbert
UltraStar Manager 1.7.2 | Infos zu meinem PC | .o0 DeathSpank 0o.

Y0Gi

God

Re: PHP Problem

Freitag, 9. April 2004, 19:18

nein, das ist OS-abhängig.

tipps:
im php-teil bringt maskieren von umlauten gar nix
umlaute kannste normal schreiben, wenn du im header die richtige code-page setzt (iso-55-irgendwas, vgl. selfhtml/w3cvalidator).
in php strings in einfache hochkommata statt doublequotes setzen, das spart insgesamt parsezeit, weil nicht nach variablen gescannt wird.

Eumel

God

Re: PHP Problem

Samstag, 10. April 2004, 10:45

Na, wenn die englischen Nutzer da "browse" stehen haben, reicht mir das eigentlich. ;)

MfG
"I've always said, the Web is the sum of all human knowledge plus porn.", Ron Gilbert
UltraStar Manager 1.7.2 | Infos zu meinem PC | .o0 DeathSpank 0o.

Y0Gi

God

Re: PHP Problem

Samstag, 10. April 2004, 14:14

bei mir in opera steht da "choose", in firefox "browse..." - geht in ordnung? :)

Eumel

God

Re: PHP Problem

Samstag, 10. April 2004, 17:35

*hehe* OK.

MfG
"I've always said, the Web is the sum of all human knowledge plus porn.", Ron Gilbert
UltraStar Manager 1.7.2 | Infos zu meinem PC | .o0 DeathSpank 0o.