ContactForm7 File test and display upload result
-
Hi,
I have a ContactForm7 form that I use to users send me some files by email, I need help todisplay a page with confirmation of sending, and info get by php about the file.
I only get “File too large or bad file extension.” and this information is in a blank page (2 problems to solve) how do I put result in a page of my site? PHP is executed but don’t see file that is uploaded in order to processe .
I have this in CF7 Form additional configurationson_sent_ok: "location = 'https://www.example.com/files/filetest.php';
I have in filetest.php
<?php $allowedExts = array("jpg"); $extension = strtolower( end(explode(".", $_FILES["file"]["name"])) ); // if (($_FILES["file"]["size"] < 200000) // && in_array($extension, $allowedExts)) if(in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "<H2>Submission Success</H2><BR>"; echo "<H2>Details of the File</H2><BR>"; $fname = $_FILES["file"]["tmp_name"]; echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Stored in: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } echo "<BR>"; } } else { echo "File too large or bad file extension."; } function __autoload($class_name) { include 'classes/'.$class_name . '.php'; } ?>
Thanks
- The topic ‘ContactForm7 File test and display upload result’ is closed to new replies.