By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

upload image (win]

P: n/a
Hi,

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

in my Form :

<form name="form1" method="post" action="do_inscription.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="multipart/form-data"></td>
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
..

in my "action script" :
.....
$file = $HTTP_POST_FILES['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

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You need to set your form's enctype:
<form name="form1" method="post" action="do_inscription.php"
enctype="multipart/form-data">

- Kevin

"Alexandre Jaquet" <no@email.com> wrote in message
news:41***********************@news.sunrise.ch...
Hi,

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

in my Form :

<form name="form1" method="post" action="do_inscription.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="multipart/form-data"></td>
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
..

in my "action script" :
....
$file = $HTTP_POST_FILES['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

Jul 17 '05 #2

P: n/a
Thanks Kevin :0)

"Kevin" <ke***@wxREMOVE4SPAM3.com> wrote:
You need to set your form's enctype:
<form name="form1" method="post" action="do_inscription.php"
enctype="multipart/form-data">

- Kevin

"Alexandre Jaquet" <no@email.com> wrote in message
news:41***********************@news.sunrise.ch. ..
Hi,

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

in my Form :

<form name="form1" method="post" action="do_inscription.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="multipart/form-data"></td>
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
..

in my "action script" :
....
$file = $HTTP_POST_FILES['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



Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.