While I was trying to uplaod file using php on windows machine its working fine :
<form action="php/bulk.php"
enctype="multipart/form-data" method="post">
<p>
Please specify a file below:<br>
</p>
<div>
<input id="datafile" type="file" name="datafile" size="40"><br>
<input type="submit" value="Upload File">
</div></form>
code on bulk.php :
$connector = new DbConnector();
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['datafile']['name']);
if(move_uploaded_file($_FILES['datafile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['datafile']['name']).
" has been uploaded.
";
} else{
echo "There was an error uploading the file, please try again!";
?>
<form action="../addsamples.php">
<input type="submit" value="Go Back" />
</form>
<?php
exit (-1);
}
I tried uploading on server and its not working there ! Do Operating system play any role in this ? My server is red hat linux and test m/c is windows