I want to make a code for me to upload pictures to the server side. The url for that code is here:
http://mili.phpwebhosting.com/~llama/PHPtesting/UploadFile.php
The code is here:
<html>
<head>
<title>
</title>
</head>
<?php
$file_url="http://mili.phpwebhosting.com/~llama/PHPtesting/Uploads"; //url for
$file_dir="/home/llama/www/PHPtesting/Uploads";
foreach($HTTP_POST_FILES as $file_name=>$file_array){
print "path:".$file_array['tmp_name']."<br>\n";
print "name:".$file_array['name']."<br>\n";
print "size:".$file_array['size']."<br>\n";
print "type:".$file_array['type']."<br>\n";
if (is_uploaded_file($file_array['tmp_name'])
&& ($file_array['type']=="image/gif" || $file_array['type']=="image/jpeg")){
move_uploaded_file($file_array['tmp_name'],"$file_dir/$file_name")
or die("couldn't copy");
print"<img src=\"$file_url/$file_name\">$picname<p>\n\n";
}
}
?>
<body>
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<input type="file" name="uploadpic"><br>
<input type="text" name="picname">Type the picture's name<br>
<input type="submit" value="upload">
</form>
</body>
</html>
Please tell me why the picture can't go to the destination directory.Thanks!