POST method not working on the same page

Asked

Viewed 138 times

0

While trying to upload a file it from error

<form method="POST">
<input type="file" name="inputfileSendTorrent">
<input type="submit" name="submitSendTorrent">
</form>
<?php
if(isset($_POST['submitSendTorrent']))
{   
    $uploaddir = '/arquivos/';
$arqName = $_FILES['inputfileSendTorrent']['name'];
$arqSize = $_FILES['inputfileSendTorrent']['size'];
$arqTemp = $_FILES['inputfileSendTorrent']['tmp_name'];
$upload = move_uploaded_file($arqTemp, $uploaddir . $arqName);
}
?>

Returns the error

Notice: Undefined index: inputfileSendTorrent in C:\xampp\htdocs\LuckTor2\pages\teste.php on line 9

Notice: Undefined index: inputfileSendTorrent in C:\xampp\htdocs\LuckTor2\pages\teste.php on line 10

Notice: Undefined index: inputfileSendTorrent in C:\xampp\htdocs\LuckTor2\pages\teste.php on line 11
  • In his php.ini is set file_uploads = On? Make sure your file is within the limits set by other variables on php.ini:max_execution_time, max_input_time, post_max_size, upload_max_filesize

  • @leonardopessoa This yes.

1 answer

0

Place the attribute enctype="multipart/form-data" in the form tag, it is necessary when there is file upload.

<form enctype="multipart/form-data" method="POST">
  • The error is gone, but it is still not sending the files to the folder /arquivos/.

  • try/ files, without the first bar

  • I just tried, but it still didn’t work, my config this file_uploads=On and upload_max_filesize=2M.

  • I found the problem, files . RAR and folders do not work, know why ??

Browser other questions tagged

You are not signed in. Login or sign up in order to post.