Jump to content

[insert_php] use foundationphp\UploadFile; in a page do not work


Mikedata

Recommended Posts

Here is the script ...  It is used to upload files , It did work a few years back: Please advise

 

[insert_php]
use foundationphp\UploadFile;
session_start();
require_once 'src/foundationphp/UploadFile.php';
if (!isset($_SESSION['maxfiles'])) {
$_SESSION['maxfiles'] = ini_get('max_file_uploads');
$_SESSION['postmax'] = UploadFile::convertToBytes(ini_get('post_max_size'));
$_SESSION['displaymax'] = UploadFile::convertFromBytes($_SESSION['postmax']);
}
$max = 1024 * 1024;
$result = array();
if (isset($_POST['upload'])) {

$destination = __DIR__ . '/uploaded/';
try {
$upload = new UploadFile($destination);
$upload->setMaxSize($max);
$upload->allowAllTypes();
$upload->upload();
$result = $upload->getMessages();
} catch (Exception $e) {
$result[] = $e->getMessage();
}
}
$error = error_get_last();
?>








 

size=10

 

 

{$error['message']}

 

";
}
if ($result) {
foreach ($result as $message) {
echo "

·          

$message

";
}
}?>

Top of Form


Name......
>Enter Name >Rose James >Joseph Goldman * Must Be filled just once !!!!!


Select File:_ data-postmax=""
data-displaymax="">

Image Title 40max.: *

Sequence:... Image 1 Image 2 Image 3 Makeup * Image 3 is for Final competition only !!!!!!

Competition: Digital Creative Artistry Color Print Mono Print Nature Club Comp Journalist Assigned Special Other *

 

Judges Comments:... No Yes * (See the Comments Policy or notes below)

* All fields must be filled, I mean ALL. Even when you may have made a selction, GO BACK AND CHECK!!!

Each file should be no more than .

Submission Rules apply as before. Review submission policy

Please check and recheck, before pressing the *Upload/Submit* button

Some Browsers will not display a box to the left of the "Upload File" button, It is Ok. Press the button

For Color Prints Or Mono Prints, Submit the file used for the print; using same size/rules mentioned above.

If 'Competition Type' allows comments, Image 1 is automatically commented. If wanted, select yes for Images 2.

Bottom of Form




[/insert_php]

 

Link to comment
Share on other sites

Let me add what is not working:

When the page loads in the website. it shows this code and nothing more:

[insert_php]
use foundationphp\UploadFile;
session_start();
require_once 'src/foundationphp/UploadFile.php';
if (!isset($_SESSION['maxfiles'])) {
$_SESSION['maxfiles'] = ini_get('max_file_uploads');
$_SESSION['postmax'] = UploadFile::convertToBytes(ini_get('post_max_size'));
$_SESSION['displaymax'] = UploadFile::convertFromBytes($_SESSION['postmax']);
}
$max = 1024 * 1024;
$result = array();
if (isset($_POST['upload'])) {

$destination = __DIR__ . '/uploaded/';
try {
$upload = new UploadFile($destination);
$upload->setMaxSize($max);
$upload->allowAllTypes();
$upload->upload();
$result = $upload->getMessages();
} catch (Exception $e) {
$result[] = $e->getMessage();
}
}
$error = error_get_last();
?>

Link to comment
Share on other sites

Thanks for responding. I am not sure  if other php codes are not working or not, as everywhere else  is OK.

setting in the site is OK and  The PHP  is to the latest

Viewing the source page, it is very large and lots of coding.

Viewing it from wordpress it does not start  with <?

Since you mentioned, I did ad <? before   [insert_php]  and tried. No change it now displays the same with the <?

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.