file upload funkt nicht


  • claus
  • 1101 Aufrufe 3 Antworten

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • file upload funkt nicht

    Benutze die neuste version von php, bei der die globalen variablen auf off stehen.
    Habe ein formular gemacht wo man das entsprechende jpg oder png und gif auswählen kann.
    Wenn ich dieses formular einem php script sende.
    kennt er natürlich die variablen nicht.
    ich les sie mit $file=$_REQUEST['variable'] ein.
    nur meine variablen file_name , file_size sind nicht bekannt und auch in der variablen $file steht nur array.
    Ich bekomme das nicht so richtig gebacken wäre nett wenn mir einer helfen könnte.

    thx a lot
    the-dude :cool:
  • muss du das unbedingt über $_REQUEST realisieren?

    guck mal hier:

    Quellcode

    1. if ( $bild != "" && $bild != "none" )
    2. {
    3. $size = $bild_size;
    4. $picname = $bild_name;
    5. $type = $bild_type;
    6. global $pfad;
    7. $pfad = "pfad/zum/bild/".$picname;
    8. copy ( $bild, $pfad );
    9. }
    Alles anzeigen



    weil wenn du über $_REQUEST gehst:


    Request variables: $_REQUEST

    Note: Introduced in 4.1.0. There is no equivalent array in earlier versions.

    An associative array consisting of the contents of $_GET, $_POST, and $_COOKIE.

    Note: Prior to PHP 4.3.0, $_FILES information was also included into $_REQUEST.

    This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_REQUEST; to access it within functions or methods.

    If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_REQUEST array. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.


    sh: php.net/manual/en/printwn/reserved.variables.php

    also meine variante klappt auf jeden fall ..

    ach und noch was: bei windows servern müssen die folder mit chmod 777 von nem unix server direkt gemirrort sein, sonst stimmts mit den schreibrechten nicht ;)
  • Habs schon rausgefunden.


    $Bild_name = $_REQUEST['Bild']['name'];
    $Bild_size = $_REQUEST['Bild']['size'];
    $Bild_type = $_REQUEST['Bild']['type'];
    $Bild_tmp_name = $_REQUEST['Bild']['tmp_name'];

    Das file feld in html hat den Namen 'Bild'.

    Hier sind dann alle Informationen drin wo ich benötige.
    Das bild wird vom html formular bereits hochgeladen und kann dann mit $Bild_tmp_name an die gewünschte stelle kopiert werden.

    Ist ganz einfach wenn man nur als wußte wie.

    In diesem Sinne rechtherzlichen dank für deine Mühe.
    Schmeiße dir auch mal einen Stein in den Garten.:eek:

    thx
    the-dude:cool:

    PS: wenn ich mich nicht täusche funktioniert deins in PHP 4.2.0 auch nicht mehr. wenn Globals in der php.ini auf off stehen.
  • hm .. doch, müsste eigentlich schon funktionieren, trotz register globals = off ..

    .. glaube zumindest, dass es auf off steht .. ;)

    und wenn ich dich mit dem stein erwische, dann setzt´s was ;) :P