Jump to content

Checking file mime type and limiting uploadable files


potternet

Recommended Posts

I have this script, generated by website x5 evolution 9, which is used to process an html form. I wish to limit the file types that people can upload to my server but I cannot seem to work out how to do it. Can anyone help me please?

 

<?php
$settings['imEmailForm_17_5'] = array(
	"owner_email_from" => "eMail Address",
	"owner_email_to" => "admin@potternet.net",
	"customer_email_from" => "do-not-reply@potternet.net",
	"customer_email_to" => "eMail Address",
	"owner_message" => "",
	"customer_message" => "We thank you for your enquiry and will get back to you within 48 hours to begin the process of verifying the information you have sent to us and begin creating the template for your site. 

Kind Regards,
PotterNet Site Admin Team",
	"owner_subject" => "Advert Request",
	"customer_subject" => "Thank you for yourAdvert Request",
	"owner_csv" => True,
	"customer_csv" => True,
	"confirmation_page" => "../advertising-home.html"
);

if(substr(basename($_SERVER['PHP_SELF']), 0, 11) == "imEmailForm") {
	include "../res/x5engine.php";

	$answers = array(
	);

	$form_data = array(
		array('label' => 'Accept Terms & Conditions?', 'value' => $_POST['imObjectForm_5_1']),
		array('label' => 'Name', 'value' => $_POST['imObjectForm_5_2']),
		array('label' => 'eMail Address', 'value' => $_POST['imObjectForm_5_3']),
		array('label' => 'Website URL', 'value' => $_POST['imObjectForm_5_4']),
		array('label' => 'Company Name', 'value' => $_POST['imObjectForm_5_5']),
		array('label' => 'Do you require text in your advert?', 'value' => $_POST['imObjectForm_5_7']),
		array('label' => 'Do you want us to design your advert for you?', 'value' => $_POST['imObjectForm_5_8'])
	);

	$files_data = array(
		array('label' => 'Company Logo', 'value' => $_FILES['imObjectForm_5_6']),
		array('label' => 'Advert Images', 'value' => $_FILES['imObjectForm_5_9'])
	);

	if(@$_POST['action'] != "check_answer") {
		if(!isset($_POST['imJsCheck']) || $_POST['imJsCheck'] != "jsactive")
			die(imPrintJsError());
		if (isset($_POST['imCpt']) && !isset($_POST['imCptHdn']))
			die(imPrintJsError());
		if(isset($_POST['imSpProt']) && $_POST['imSpProt'] != "")
			die(imPrintJsError());
		$email = new imSendEmail();
		$email->sendFormEmail($settings['imEmailForm_17_5'], $form_data, $files_data);
		@header('Location: ' . $settings['imEmailForm_17_5']['confirmation_page']);
	} else {
		if(@$_POST['id'] == "" || @$_POST['answer'] == "" || strtolower(trim($answers[@$_POST['id']])) != strtolower(trim(@$_POST['answer'])))
			echo "0";
		else
			echo "1";
	}
}

// End of file

 

Fingers crossed, someone can help me. lol  :shrug:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.