我正在为自己创建一个生成文本文件的用户界面,但我想在本地系统中设置我想要的位置。就像我想在我的页面中保存为按钮一样。我正在使用文件上传标签但只需上传文件。
enter code here
<html>
<body>
<table width="60%">
<tr>
<td>Browser name</td>
<td><select name="browser" id="browser" class="form-control-sm" required>
<option id="select" value="">--Select--</option>
<option id="gc" value="google_chrome">Google Chrome</option>
<option id="mf" value="mozilla_firefox">Mozilla Firefox</option>
<option id="op" value="opera">Opera</option>
</select></td>
</tr>
<tr>
<td>Instance name</td><td><input type="text" id="instancename" class="form-control-sm" name="instance" required></td>
</tr>
<tr>
<td>file Path</td><td><input type="file" id="config" class="form-control-sm" name="config" required></td>
</tr>
</table>
<p><input type="submit" value="Submit" name="submit" id="submit" class="btn btn-primary">
</body>
</html>
<?php
if (isset($_POST["submit"])) {
$browser = $_POST['browser'];
$instance = $_POST['instance'];
$output = "browsername=".$browser."\r\ninstancename=".$instance.;
$file = fopen("exemple.txt","w+");
fwrite($file,$output);
fclose($file);
print_r(error_get_last());
echo realpath("example.txt");
}
?&GT;