PHP

25
May

Upload Image & Compress Image Size

Upload Image & Compress Image Size HTML Code For File Uploading <form action=”upload.php” method=”post” name=”video_upload” enctype=”multipart/form-data”> <input name=”new_image” id=”new_image” size=”30″ type=”file” multiple=”true” /> <input type=”submit” value=”submit” name=”submit” /> </form>   File Name upload.php <?php if (isset ($_FILES[‘new_image’])){ $imagename = $_FILES[‘new_image’][‘name’]; $source = $_FILES[‘new_image’][‘tmp_name’]; $type=$_FILES[‘new_image’][‘type’]; $idate=$_REQUEST[‘idate’]; if(($_FILES[‘new_image’][‘type’]==’image/jpeg’) || ($_FILES[‘new_image’][‘type’]==’image/png’)|| ($_FILES[‘new_image’][‘type’]==’image/bmp’)|| ($_FILES[‘new_image’][‘type’]==’image/tiff’)|| ($_FILES[‘new_image’][‘type’]==’image/gif’)) { $target = “../upload/”.$imagename; move_uploaded_file($source, $target); $imagepath = $imagename;

Read more

25
May

How To Connect Database in PHP

How To Connect Database in PHP <?php $host=”localhost”; $user=”root”; $pass=””; $database=”databasename”; $conn=mysql_connect($host,$user,$pass); mysql_select_db($database); $_GET = array_map(‘trim’, $_GET); $_COOKIE = array_map(‘trim’, $_COOKIE); if(get_magic_quotes_gpc()): $_GET = array_map(‘stripslashes’, $_GET); $_POST = array_map(‘stripslashes’, $_POST); $_COOKIE = array_map(‘stripslashes’, $_COOKIE); $_REQUEST = array_map(‘stripslashes’, $_REQUEST); endif; //$sql = ‘SELECT * FROM create_user’; // //$result=mysql_query($sql,$conn); // //    while($row = mysql_fetch_assoc($result)) { // //       echo $row[‘_company’]; //      } ?>