我正在尝试将文件上传到远程主机,但在上传 60 秒后收到 400 错误请求,我不知道这是会话问题还是防火墙问题。该代码在我的本地主机和其他服务器上运行良好<!DOCTYPE html><html><body> <form action="upload.php" method="post" enctype="multipart/form-data"> Select file to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload file" name="submit"> </form></body></html>// upload.php file<?phpini_set('max_execution_time', 300);ini_set('display_errors', 1);ini_set('display_startup_errors', 1);error_reporting(E_ALL);?><?php$target_dir = "docs/";$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);$uploadOk = 1;if(isset($_POST["submit"])) { if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; } else { // if condition to check if the file has been uploaded or not if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; }else { echo "Upload failed"; } }}?>php.ini文件内容:display_errors = Onmax_execution_time = 300max_input_time = 300max_input_vars = 8000memory_limit = 256Mpost_max_size = 192Msession.gc_maxlifetime = 1440session.save_path = "/var/cpanel/php/sessions/ea-php73"upload_max_filesize = 256Mzlib.output_compression = Off托管支持说他们测试了服务器,一切正常。
添加回答
举报
0/150
提交
取消