0

hello guys i am making student form for my database and i want to add a image tag so that person can brows the student photo from the computer...how can i do this please help me out..

4
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by krabz01
0

thanks for the reply but little confusion. i not only want to brows it but also to show photo on the current page while it brows it from the pc

Edited by extemer: n/a

0

I think the image will display only after upload to the server up to my knowledge... you can try with ajax to upload an image onchange event of file input and display wherever you required..

Edited by karthik_ppts: n/a

0

try this
upload.php

<?php
  include 'function.php';
  include 'config.php';
  if(!$_POST["category"]||!$_POST["name"]||!$filename= $_FILES['uploaded']['name']){ echo "Please enter conteny"; exit;}
 $category= $_POST["category"];
 $filename= $_FILES['uploaded']['name'];
 $name=$_POST["name"];
 $date=@date ("Y-m-d H:i:s");

  upload($x);
   $sql = "insert into events (cover,name,date,description) values
   ('$filename','$name','$date','$category')";

    mysql_query($sql) or
    die ('Sorrry');

 ?>

function.php

<?php
function upload($x){
	
	$target = "uploads/$x/"; 
 $target = $target . basename( $_FILES['uploaded']['name']) ; 
 $ok=1; 
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
 {
 echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
  }
	
	// The file
$filename = "uploads/". basename( $_FILES['uploaded']['name']);
$percent = 0.1;

// Content type


	}
	

?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.