Function Button2_onclick()
var input = document.createElement("input")
input.type = "file"
input.click()
End Function
This popups a Dialog, where I can choose a file or a picture on a mobile.
But how do I get the choose file to my web server?
I try it with this command:
Ajax("upload.php","POST",input.value) ' I think input.value is not correct
But there is no upload to my php script.
<?php
if (isset($_FILES['datei']))
{
move_uploaded_file($_FILES['datei']['tmp_name'], 'upload/'.$_FILES['datei']['name']);
}
?>
with button3 opens the window to choose a file in a browser or image on the mobile
with button2 the file was transfer to the server, but remember, you need write-rights in the directory on the server
Now I can build my own file box.
best regards
Udo
Function Button2_onclick()
formData = new FormData()
client = new XMLHttpRequest()
formData.append("datei",input.files[0])
client.open("POST", "upload.php")
client.send(formData)
End Function
Function Button3_onclick()
input = document.createElement("input")
input.type = "file"
input.click()
End Function