ezis Posted April 8, 2009 Report Posted April 8, 2009 (edited) cenšos uztaisīt skriptu, kas ļauj uploadot attēlus kurus pēcāk izmantos lietotājiem avatarā.. bet problēma ir tāda, ka nostrādā errors par nepareizu faila formātu, bet tā nav.1 :@ nezinu kur ir vaina.. varbūt nepareizi ko esmu saraxtījis :\ pati forma: <form class="form" method="post" action="<?=$_SERVER['REQUEST_URI']?>"> <input type="hidden" name="_submit_check_avatarup" value="1"/> <label for="imagefile">izvēlies attēlu:</label> <input type="file" name="imagefile" id="imagefile" class="form"> <br /><br /> <input type="reset" value="Clear" class="form"> <input type="image" name="register" value="register" class="submit-btn_up" src="template_images/boxes/btn.gif" alt="submit" title="submit" /> </form> un php: $idir = "images/"; if ( array_key_exists ( '_submit_check_avatarup', $_POST ) ) { if ((($_FILES['imagefile']['type'] == "image/jpg") || ($_FILES['imagefile']['type'] == "image/jpeg") || ($_FILES['imagefile']['type'] == "image/gif")) && ($_FILES["imagefile"]["size"] < 9000000)) { $copy = copy($_FILES['imagefile']['tmp_name'], "$idir" . $_FILES['imagefile']['name']); if ($copy) { $msg_av = 'Tavs avatars ir ielādēts.'; } else { $error_av = 'Neizdevās ielādēt avataru.'; } } else { $error_av = 'Nepareizs faila formāts.'; } } Edited April 8, 2009 by ezis Quote
KillerBean Posted April 9, 2009 Report Posted April 9, 2009 (edited) Viss jau it kā pareizi, tikai <form> tagā aizmirsi norādīt tādu lietu, kā "enctype": <form class="form" method="post" enctype="multipart/form-data" action="<?=$_SERVER['REQUEST_URI']?>"> Edited April 9, 2009 by KillerBean Quote
ezis Posted April 9, 2009 Author Report Posted April 9, 2009 Viss jau it kā pareizi, tikai <form> tagā aizmirsi norādīt tādu lietu, kā "enctype": <form class="form" method="post" enctype="multipart/form-data" action="<?=$_SERVER['REQUEST_URI']?>"> jup ^^ tas palīdzēja paldies :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.