using http post via swing, , url http://udaydungarwal.com/fileuploadhtml/upload.php , however, not receive file on server. can please, php script is:
<?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_files["fieldname"]["name"]); $uploadok = 1; $imagefiletype = pathinfo($target_file,pathinfo_extension); // check if image file actual image or fake image if(isset($_post["submit"])) { $check = getimagesize($_files["fieldname"]["tmp_name"]); if($check !== false) { echo "file image - " . $check["mime"] . "."; $uploadok = 1; } else { echo "file not image."; $uploadok = 0; } } // check if file exists if (file_exists($target_file)) { echo "sorry, file exists."; $uploadok = 0; } // check file size if ($_files["fieldname"]["size"] > 500000) { echo "sorry, file large."; $uploadok = 0; } // allow file formats if($imagefiletype != "jpg" && $imagefiletype != "png" && $imagefiletype != "jpeg" && $imagefiletype != "gif" ) { echo "sorry, jpg, jpeg, png & gif files allowed."; $uploadok = 0; } // check if $uploadok set 0 error if ($uploadok == 0) { echo "sorry, file not uploaded."; // if ok, try upload file } else { if (move_uploaded_file($_files["fieldname"]["tmp_name"], $target_file)) { echo "the file ". basename( $_files["fieldname"]["name"]). " has been uploaded."; } else { echo "sorry, there error uploading file."; } } ?>