upload image (win]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexandre Jaquet

    upload image (win]

    Hi,

    I can't figure what I've doing wrong with my code :

    in my Form :

    <form name="form1" method="post" action="do_insc ription.php">
    <p align="center"> <img src="images/logo.jpg" width="400" height="80"></p>
    <div align="center">
    <table width="500" border="0">
    ..
    <td><input name="avatard" type="file" id="avatard"
    enctype="multip art/form-data"></td>
    <input type="hidden" name="MAX_FILE_ SIZE" value="30000" />
    ..

    in my "action script" :
    .....
    $file = $HTTP_POST_FILE S['avatard'];

    if ($file && $file['size']<=1024000000 && $file['size']>0){
    if (copy($file['tmp_name'],"./avatard/".$file['name'])){
    echo "Fichier Uploadé";
    } else echo "L'upload à échoué.";
    }else echo "Fichier trop volumineux ou innexistant";
    ....

    When I execute this script I get this error message : Undefined index: avatard
    File to big or inexistant (translated from french(

    thx in advance

  • Kevin

    #2
    Re: upload image (win]

    You need to set your form's enctype:
    <form name="form1" method="post" action="do_insc ription.php"
    enctype="multip art/form-data">

    - Kevin

    "Alexandre Jaquet" <no@email.com > wrote in message
    news:41d15674$0 $30029$5402220f @news.sunrise.c h...[color=blue]
    > Hi,
    >
    > I can't figure what I've doing wrong with my code :
    >
    > in my Form :
    >
    > <form name="form1" method="post" action="do_insc ription.php">
    > <p align="center"> <img src="images/logo.jpg" width="400" height="80"></p>
    > <div align="center">
    > <table width="500" border="0">
    > ..
    > <td><input name="avatard" type="file" id="avatard"
    > enctype="multip art/form-data"></td>
    > <input type="hidden" name="MAX_FILE_ SIZE" value="30000" />
    > ..
    >
    > in my "action script" :
    > ....
    > $file = $HTTP_POST_FILE S['avatard'];
    >
    > if ($file && $file['size']<=1024000000 && $file['size']>0){
    > if (copy($file['tmp_name'],"./avatard/".$file['name'])){
    > echo "Fichier Uploadé";
    > } else echo "L'upload à échoué.";
    > }else echo "Fichier trop volumineux ou innexistant";
    > ...
    >
    > When I execute this script I get this error message : Undefined index:
    > avatard
    > File to big or inexistant (translated from french(
    >
    > thx in advance
    >[/color]


    Comment

    • Alexandre

      #3
      Re: upload image (win]

      Thanks Kevin :0)

      "Kevin" <kevin@wxREMOVE 4SPAM3.com> wrote:[color=blue]
      >You need to set your form's enctype:
      > <form name="form1" method="post" action="do_insc ription.php"
      >enctype="multi part/form-data">
      >
      >- Kevin
      >
      >"Alexandre Jaquet" <no@email.com > wrote in message
      >news:41d15674$ 0$30029$5402220 f@news.sunrise. ch...[color=green]
      >> Hi,
      >>
      >> I can't figure what I've doing wrong with my code :
      >>
      >> in my Form :
      >>
      >> <form name="form1" method="post" action="do_insc ription.php">
      >> <p align="center"> <img src="images/logo.jpg" width="400" height="80"></p>
      >> <div align="center">
      >> <table width="500" border="0">
      >> ..
      >> <td><input name="avatard" type="file" id="avatard"
      >> enctype="multip art/form-data"></td>
      >> <input type="hidden" name="MAX_FILE_ SIZE" value="30000" />
      >> ..
      >>
      >> in my "action script" :
      >> ....
      >> $file = $HTTP_POST_FILE S['avatard'];
      >>
      >> if ($file && $file['size']<=1024000000 && $file['size']>0){
      >> if (copy($file['tmp_name'],"./avatard/".$file['name'])){
      >> echo "Fichier Uploadé";
      >> } else echo "L'upload à échoué.";
      >> }else echo "Fichier trop volumineux ou innexistant";
      >> ...
      >>
      >> When I execute this script I get this error message : Undefined index:
      >> avatard
      >> File to big or inexistant (translated from french(
      >>
      >> thx in advance
      >>[/color]
      >
      >[/color]

      Comment

      Working...