Page 1 of 1

Upload class

Posted: Thu Feb 09, 2012 12:52 am
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,

Re: Upload class

Posted: Thu Feb 09, 2012 4:10 pm
by jacek
It looks okay, what exactly is the problem ? In what way does it not work ?