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..

Recommended Answers

All 5 Replies

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

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..

You need to download the Uploadify-v2.1.4.zip version and extract the files to uploadify folder in root.This will show the file as soon as it is uploaded....

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


	}
	

?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.