Thursday 15 March 2012

php - No error in var_dump($_FILES) during upload pictures but images not uploading -



php - No error in var_dump($_FILES) during upload pictures but images not uploading -

i have .php upload images,now when want upload image multipart/form-data .php reloaded without updating images. output of var_dump($_files)

array(1) { ["slika"]=> array(5) { ["name"]=> string(8) "test.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpe46qae" ["error"]=> int(0) ["size"]=> int(22970) } }

is showing no error image not uploaded. edit

this hole php form method="post" action="" name="form" id="form" enctype="multipart/form-data"> <label>add photo gallery</label><br> <textarea name="opiss" placeholder="description" style="margin: 2px; height: 150px; width: 238px;"></textarea><br> <input name="slika" id="slika" type="file" style="width: 238px;" /><br> <input type="checkbox" id="frienduh" name="frienduh" value="1"/> check it.<br> <span style='color: white; padding-top: 6px; font-size: 10px; float: left;'> clicking photo become public! </span><br><br> <input type="submit" id="lodd" value="add" class="button" name="dodaj" /> </form> <?php if (isset($_request['dodaj'])) { $opis=mysqli_real_escape_string($conn,$_request['opiss']); function died($error) { $poruka = "we sorry, there problem upload.\n\nerrors:\n$error\nplease right error , seek again."; ?> <script> alert(<?php echo json_encode($poruka); ?>); settimeout(function() {window.history.go(-1)}, 500); </script>; <?php die(); } if($_files['slika']['size'] < 10485760){ $opis = mysqli_real_escape_string($conn, $_post['opiss']); if(strlen($opis)>301){ died('you can come in 30 characters in description field.'); } $validextensions = array('.jpg','.jpg','.jpeg','.jpeg','.png','.png','.gif','.gif'); $fileextension = strrchr($_files['slika']['name'], '.'); if (in_array($fileextension, $validextensions)) { $newnameprefix = time() . '_'; $manipulator = new imagemanipulator($_files['slika']['tmp_name']); // resizing 200x200 $newimage3 = $manipulator->resample(800, 600); // saving file uploads folder $manipulator->save('galerija/'.$newnameprefix.$_files['slika']['name']); if (isset($_post['frienduh'])){ $frienduh=1; }else{ $frienduh=0; } $upis=mysqli_query($conn,"insert galerija values(null,".$_session['group_id'].",'".$opis."','".$newnameprefix.$_files["slika"]["name"]."',0,".$frienduh.",0,0)") or die(mysqli_error($conn)); if (isset($_post['frienduh'])){ $gal=mysqli_query($conn,"select id_gal galerija putanja_slike='".$newnameprefix.$_files["slika"]["name"]."'"); $gal_id=mysqli_fetch_array($gal,mysql_assoc); $upis2=mysqli_query($conn,"insert main_board (id_gal,group_id,doing,content) values(".$gal_id['id_gal'].", ".$_session['group_id'].", 'want check', '<br><a href=\'/friendornot/photo/".$gal_id['id_gal']."\' title=\'".$opis."\' ><img style=\'max-width:350px;max-height:250px;\' src=\'/galerija/".$newnameprefix.$_files["slika"]["name"]."\'/></a>' )") or die(mysqli_error($conn)); } }else{ died('file type not allowed!'); } }else{ died('file size must less 5mb.'); } }

just stop work week or two. not code previous developers left it. can not fine reply why upload stop work.

edit

is not problem .php problem start after updating debian 7 , php. .php working on localhost , on other server. did not fined solution if find post. folder galerija have permision, , in php.ini evrithing ok

memory_limit = 128m post_max_size = 12m file_uploads = on upload_max_filesize = 12m

you have upload them manually. read more here:

http://php.net/manual/bg/function.move-uploaded-file.php

php image image-uploading

No comments:

Post a Comment