FTP&php

Discussion dans 'Support informatique' créé par morphin, 9 Novembre 2005.

  1. soule

    soule Visiteur

    J'aime reçus:
    0
    Points:
    0
    Re : FTP&php


    le lien marche, essayes encors une fois ;-)

    http://www.geocities.com/belbagris/phpmysql.zip
     
  2. isitien

    isitien Bannis

    J'aime reçus:
    28
    Points:
    0
    Re : FTP&php

    oui mais il ya une erreur a la ligne 8 de store.php
     
  3. soule

    soule Visiteur

    J'aime reçus:
    0
    Points:
    0
    Re : FTP&php

    Warning: Undefined
    variable: submit in c:\program
    files\apache
    group\apache\htdocs\upload\store.php on
    line 8

    c'est ca la faute, alors remarques, tu dois proceder comme suivant:

    ce probleme est valide. Le code a ete cree il y'a un bon moment en utilisant des registres globale. Pour des raisons de securiteeles variables globale sont "off". Le vieu code est le suivant:

    if ($submit) {

    Doit etre remplacer par::

    if (isset($_POST['submit'])) {



    Comme cela, il y'a pas mal de corretions a faire:

    If you want to retrieve the data posted with the files part these migh help you.Code:

    $_FILES['userfile']['name']
    The original name of the file on the client machine.

    $_FILES['userfile']['type']
    The mime type of the file, if the browser provided this information. An example would be "image/gif".

    $_FILES['userfile']['size']
    The size, in bytes, of the uploaded file.

    $_FILES['userfile']['tmp_name']
    The temporary filename of the file in which the uploaded file was stored on the server.

    $_FILES['userfile']['error']
    The error code associated with this file upload.

    A sample code of uploading a file which I have done. Code:

    <?php
    if(isset($_POST['submit'])){
    if ($_FILES['form_data']['tmp_name']!=''){
    if ($_FILES['form_data']['type']=='image/pjpeg' || $_FILES['form_data']['type']=='image/jpeg'){
    $uploadfile = 'files/user_images/temp_user_picture_'.rand ( 0 ,9999 ).'.jpg';
    if (move_uploaded_file($_FILES['form_data']['tmp_name'], $uploadfile)) {
    $src_img = imagecreatefromjpeg( $uploadfile );
    $org_w = imagesx($src_img);
    $org_h = imagesy($src_img);
    if ((imagesx($src_img)<=100)&&(imagesy($src_img)<=100)){
    $user_picture_name='usrpic_'.rand ( 0 ,9999 ).'.jpg';
    $current_image_name='files/user_images/'.$user_picture_name;
    $user_picture_width=$org_w;
    $user_picture_height=$org_h;
    copy($uploadfile,$current_image_name);
    unlink ( $uploadfile );
    $image_error='';
    }else{
    $image_error="Allowed Image Dimension is 100 X 100. <br>".$_FILES['form_data']['name']." size was $org_w X $org_h.";
    unlink ( $uploadfile );
    }
    imagedestroy($src_img);
    } else {
    print "Possible file upload attack! Here's some debugging info:n";
    print_r($_FILES);
    }
    }else{
    $image_error="Given file was not a Jpeg file";
    }
    }else{
    $image_error="Please select a picture file.!!";
    }
    ?>

    si cala vous aide pour coder l'originale et le faire marcher, ca sera bien si vous pouviez poster les changement ici, comme ca les autres n'auraient pas a refaire le travail, merci et bonne continuation ;-)
     
  4. isitien

    isitien Bannis

    J'aime reçus:
    28
    Points:
    0
    Re : Re : FTP&php

    Laisses le se debrouiller seul :)
     

Partager cette page