0
I’m having a little trouble sending files. I made a functional code, on my local PC, that sent the files to my project folder using the move_uploaded_file
, worked correctly. Only I want to apply this same code on my site and I can not at all. My site is developed in Wordpress. Does it have anything to do with Wordpress?
$target_dir = 'arquivos/';
if( isset($_FILES['file']['name'])) {
$total_files = count($_FILES['file']['name']);
for($key = 0; $key < $total_files; $key++) {
// Check if file is selected
if(isset($_FILES['file']['name'][$key])
&& $_FILES['file']['size'][$key] > 0) {
$original_filename = $_FILES['file']['name'][$key];
$target = $target_dir . basename($original_filename);
$tmp = $_FILES['file']['tmp_name'][$key];
move_uploaded_file($tmp, $target);
}
}
}
Which file is this code? Which route are you using? Does an error appear? Click [Edit] and add to your question, if possible.
– Valdeir Psr
It does not generate any error. It simply does not use the files. I even managed to save the file name in the database but does not use the files.
– Matheus Silva Soares