Validation Jpeg image, jpg and png in php

Ass ..... I am now going to discuss about how to filter upload image or file. So gini habits like fun in the security of a website so that the website clicking any error or order one through to amanannya the image or file uploads. So in order to upload images or files safely we have to limit the upload image or file like-image can only Type Jpg, Jpeg, Png or file and can only zip and pdf
I will not give an example for image alone can try to file your own by ..
example scriptè



$ tipe_file = $ _FILES ['file name field'] ['type']; / / to find out who uploaded Type apah
$ formatgambar = array ("image / jpg", "image / jpeg", "image / gif", "image / png");/ / to find out who are allowed apah
$ namaimage = $ _FILES ['file name field'] ['name'];/ / to retrieve the name of the uploaded photo
$ alamatimage = $ _FILES ['file name field'] ['tmp_name'];/ / to hold while a photo or image around
$ image = move_uploaded_file ($ alamatimage, 'formphp / News / images /'. $ namaimage); / / to move the photos to a folder that we provide suah
if (! in_array ($ tipe_file, $ formatgambar)) {/ / if $ tipe_file, $ formatgambar not the same
  echo "<script> alert ('image format incorrect') </ script>";/ / mesage
else {}
/ / example script insert
mysql_query ("INSERT INTO` table name `(
`Id`,
`Title`,
`ImageNews`,
)
VALUES (
'', '$ _POST [Title]', '$ namaimage') ");}

echo "<script> alert ('save successfully'); </ script>";

A few of my thank you respectfully
Source MYBLOG Inspiration OF Dreams

Penulis : Unknown ~ Sebuah blog yang menyediakan berbagai macam informasi

Artikel Validation Jpeg image, jpg and png in php ini dipublish oleh Unknown pada hari Monday, July 29, 2013. Semoga artikel ini dapat bermanfaat.Terimakasih atas kunjungan Anda silahkan tinggalkan komentar.sudah ada 0 komentar: di postingan Validation Jpeg image, jpg and png in php
 

0 comments:

Post a Comment