• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Would somone please write me a simple script

Master_tee

New Member
I need a script - where you browse for a file - click upload and its uploaded.
All the scripts ive tryed so far havent worked :(
I need to be able to restrict file types.

Thanks.
[Your doing this for the good of a new image/file host] :)
 
Phew!....

Originally posted by NancyDowns
Try Genesis, it has an auto installer and it seems to have everything you request. Hope that helps!

I've just tried for it and it is a $38 Shareware. Disappointed. do any one know a free script?
 
Originally posted by keith
i wrote one for a few people a while back that restricts file size and types.

Keith is a very good php programmer ( ;) ) and I think for $38+ he could build you one that you need.
 
Far from my best work but here we go..

save.php
PHP:
<?$image = $_FILES['image'];

foreach($image['tmp_name'] as $key=>$tmp_name)
{
	if ($tmp_name!=='none')
	
	{
	 
		$ext="";
		$type_image = $image['type'][$key];
		
		if ( $type_image=='image/x-png')
			{
				$ext='png';
			}
		
		elseif ( $type_image=='image/gif')
			{
				$ext='gif';
			} 
		elseif ( $type_image=='image/pjpeg')
			{
				$ext='jpg';
			} 
		
		 if ($ext!=="")
		 	{
		
		$file_data = rename( $image['tmp_name'][$key], "files/" .$image['name'][$key] );
		
			}
	}

}

addfile.php

PHP:
<form enctype="multipart/form-data" name="upload_images" action="save.php" method="post">
		<?
		for($i=1; $i <= 10; $i++)
		{
			?>
			<input type="file" name="image[<?= "$i" ?>]" class=screenshotInput><br>
			<?
		}
		?>
	
	<input type="hidden" name="MAX_FILE_SIZE" value="100000">
	<input type="submit" name="Submit" value="UPLOAD">
	</form>
 
Back
Top