uploading graphic problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
manpreet_jsb
Forum Newbie
Posts: 3
Joined: Fri Apr 04, 2008 12:14 pm

uploading graphic problem

Post by manpreet_jsb »

hi to every one, i am using simple code for upload .gif or .jpg image but my code is not working, image not uploading on server but database getting recorde. i am using below given code

one my page test.php

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-9' />
<title>welcome to ermata&#351;</title>
</head>
<body>
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>



and uploader.php is
<?php
$target_path = "uploads/";
if($_FILES['image_link']['error'] == UPLOAD_ERR_OK) {
print "This work";
return;
}
//$_FILE[user][error]=> 6
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>


but in result its showing "There was an error uploading the file, please try again"

pls help me to solve this problem....is it problem related to server?#

thanx alot.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: uploading graphic problem

Post by aceconcepts »

Have you checked the directory permissions?
Post Reply