Upload class

Any problems relating to the premium downloads should go in here
Post Reply
inzid
Posts: 1
Joined: Thu Feb 09, 2012 12:48 am

Upload class

Post by inzid »

Hi,

Sorry if this comes across as me being dumb but here it goes haha.


I currently have this website up and live

http://proa.co.nz/informationlemployee.html

when you click yes it drops down the rest of the contact form.. where it says "Email your scanned copy to info@proa.co.nz"

I want it to have an upload box and when you click submit it sends the attachment along with the rest of the information.



I have edited the above html page to php and uploaded here;

http://callumpirie.com/dev/test/test.php

It doesnt seem to want to work here is the following php code;

<input type="radio" name="radio" id="YES5" value="YES">
                    </label>
                      <label>	
					  
					  <?php include('secure_upload.class.php'); ?>

					  
					  <?php
		
		if (isset($_FILES['image'])){
			$upload = new secure_upload('image');
			$upload->set_max_size(500 * 1024);
			$upload->set_type_whitelist(array('image'));
			$upload->set_extension_blacklist(array('php', 'phtml', 'php4', 'php5', 'pht', 'phps'));
			$upload->save_to('./files/' . $upload->name);
			
			if ($upload->error > 0){
				echo '<div>Error: ', $upload->get_error_constant_name(), '</div>';
			}else{
				echo '<img src="files/', $upload->name ,'" alt="', $upload->name, '" />';
			}
		}else{
			?>
			<form action="" method="post" enctype="multipart/form-data">
				<div>
					<input type="file" name="image" />
					<input type="submit" value="Upload" />
				</div>
			</form>
			<?php
		}
		
		?>
                      <br>
<br>
OR<a href="downloads/Authorisation Form.doc"><br>
<br>

Any help would be awesome!

Thanks,
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Upload class

Post by jacek »

It looks okay, what exactly is the problem ? In what way does it not work ?
Image
Post Reply