1
I have this code that records the form information in a file TXT.
But I can’t upload (an image for example).
How can I do that?
Code:
<?php
$file = 'apeople.txt';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= $_POST ["top"]; $current .= "\n";
$current .= $_POST ["texto"]; $current .= "\n";
$current .= $_FILES ['arquivo']; $current .= "\n";
$current .= $_POST ["rodape"]; $current .= "\n";
// Write the contents back to the file
file_put_contents($file, $current);
?>
The value of
$_FILES ['arquivo']
is not what you think it is, make avar_dump
from him to see what’s inside– Costamilam
I don’t understand what I mean friend, I’m a little layy in php.
– F. Júnior
And how you want to store an image inside a TXT file?
– Woss
Read the documentation: http://php.net/manual/en/features.file-upload.post-method.php
– edson alves
No, I want it to be root or in a folder, but your information to be in the file, like this: <img style="width: auto; height: auto;" alt="" src="img.jpg">
– F. Júnior