Using code found on this page
Code:
http://www.w3schools.com/php/php_file_upload.asp
I can confirm that my system is compatable to my server. I can upload a grafic image.
Every example I see is about transfering a previously writen file or image to the server. Nothing I have found tells me how to create a filename and write form date to that filename.
To create the filename I modified W3 examples:
Code:
<html>
<body>
<form action="create_file_user_name.php" method="get" enctype="text/plain">
Enter your real name as it will be used several times: <input type="text" name="fname" /><br />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
create_file_user_name.php
Code:
<?php
echo >> upload/"$fname";
?>
That did not work.
create_file_user_name.php
Code:
<?php>
touch(upload/"$fname");
</>
That did not work.
Looking to trap an error I found this example else where on the web.
create_file_user_name.php
Code:
<?php
// try and create a file in the directory
if ($_FILES["text"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
if(!touch("upload/$fname")) {
echo("Can't touch "$fname" file");
exit;
}
if(!unlink("upload/$fname")) {
echo("Can't unlink "$fname" file");
exit;
}
}
else
{
echo "Invalid name";
}
?>
This was not successful and did not return an error message.
And this did not work.
Code:
<?php
$file = fopen("test.txt","r+w");
//some code to be executed
fclose($file);
?>
I give up, how do I create an empty file name on my server?