Skip to content

Commit

Permalink
Load classes earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Oct 29, 2020
1 parent 9a85f49 commit 3dffb3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/send_file_upload.phps
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;

require '../vendor/autoload.php';

$msg = '';
if (array_key_exists('userfile', $_FILES)) {
// First handle the upload
Expand All @@ -20,7 +22,6 @@ if (array_key_exists('userfile', $_FILES)) {
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
// Upload handled successfully
// Now create a message
require '../vendor/autoload.php';
$mail = new PHPMailer();
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
Expand Down
3 changes: 2 additions & 1 deletion examples/send_multiple_file_upload.phps
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;

require '../vendor/autoload.php';

$msg = '';
if (array_key_exists('userfile', $_FILES)) {
require '../vendor/autoload.php';
// Create a message
$mail = new PHPMailer();
$mail->setFrom('from@example.com', 'First Last');
Expand Down

0 comments on commit 3dffb3e

Please sign in to comment.