html page <form action="upload.PHP" enctype="multipart/form-data" method="post"> <input type =file name=kk> <input type=submit> </submit> PHP page upload.PHP <?PHP $file=trim($_FILES['kk']['name']; if(move_uploaded_file($_FILES['kk']['temp_name'],$folder.$file)) { echo"<h1>file uploaded"; } else{echo"<h1>not";} ?> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

html page <form action="upload.PHP" enctype="multipart/form-data" method="post"> <input type =file name=kk> <input type=submit> </submit> PHP page upload.PHP <?PHP $file=trim($_FILES['kk']['name']; if(move_uploaded_file($_FILES['kk']['temp_name'],$folder.$file)) { echo"<h1>file uploaded"; } else{echo"<h1>not";} ?>

can anybody tell be where i'm doing this programme wrong.. it shows an error undefined index:kk in c:\..... on line 6

14th Nov 2016, 12:03 PM
MANISH KALIA
MANISH KALIA - avatar
5 Answers
+ 2
use isset function, this type of error occur when PHP understand that there is already a data. try if(isset($_FILES["kk"]) { //here goes your code } if there is a problem again please comment. I love to help.
14th Nov 2016, 1:17 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
I think your html code is wrong. It should be, <input type="file" name="kk"> <input type="submit">
15th Nov 2016, 9:25 AM
Fendi Septiawan
Fendi Septiawan - avatar
0
php extension...."PHP" change it to "php" :)
14th Nov 2016, 12:40 PM
NabiL
NabiL - avatar
0
also input type is not good....what type of input it is.... use (" ") in the name of input
14th Nov 2016, 12:42 PM
NabiL
NabiL - avatar
0
thanks alot!!
18th Nov 2016, 2:11 PM
MANISH KALIA
MANISH KALIA - avatar