Jump to content

PHP upload scripts? which is the best? any suggestions?


Orionsbelter

Recommended Posts

Ok so i'm a newbie, and i in need of scripts that is possible free easy to install or to add to a sever. It needs to allow me to upload multiple files set the locations of the files in the script and it also need to be able to make decent thumbnails on each uploaded image.

 

All setting need to be easy to change and the files needs to be clean and easily understandable for a newbie does anyone have any sugesstions??

 

 

THank you for reading

 

 

Link to comment
Share on other sites

  • 3 weeks later...

yeah i know, like i said its only for thumbnailing, but at the time it was  enough for what i needed, i have outgorwn it since, but i make my own upload scripts since thats very easy. heres a snippet for you, I have pulled it from a class i wrote so will need a little bit of adjusting. it returns an array with 2 values, key 0 is either true or false and key 1 has a message:

 

<?php
function handleUpload($fieldname)
{
$settings = systemcomponent::getSettings();//remove this as its irrelevant to you
$upload = array();
if ((($_FILES["$fieldname"]["type"] == "image/gif")
|| ($_FILES["$fieldname"]["type"] == "image/jpeg")
|| ($_FILES["$fieldname"]["type"] == "image/pjpeg"))
&& ($_FILES["$fieldname"]["size"] < 200000) || ($_FILES["$fieldname"]["name"] == "")) //this bit restricts size and file type
{
	if ($_FILES["$fieldname"]["error"] > 0 && $_FILES["$fieldname"]["error"] != 4)
		{
			$this->errors[] = "Image not saved in ImageControl->handleUpload(); || Return Code: " . $_FILES["$fieldname"]["error"] . "<br />"; //insert failed! Add error description to list of errors
			$upload[0] = 0;
			$upload[1] = "Image did not save";
			return $upload;
		}
  else
	{
		$filename = str_replace("'","",$_FILES["$fieldname"]["name"]); // escape ' in file name! curse these people who not know how file naming should be done! lol
		if (file_exists($settings['imagedir'] . $_FILES["$fieldname"]["name"]))
		  {		
			$upload[0] = 0;
			if ($_FILES["$fieldname"]["name"] == "")
			{
				$upload[1] = "please select a file.";
			}
			else
			{
				$upload[1] = $_FILES["$fieldname"]["name"] . " already exists. ";

			}
			return $upload;
		  }
		else
		  {
			move_uploaded_file($_FILES["$fieldname"]["tmp_name"],$settings['imagedir'] . $filename);//change the $settings['imagedir'] to your upload directory
			$upload[0] = 1;
			$upload[1] = $filename;
			return $upload;
		  }
		}
}
else
{
	$upload[0] = 0;
	$upload[1] = "file type restricted or too large";
	return $upload;
}

}

?>

Link to comment
Share on other sites

I too would like a recommendation for a good multiple-file upload script / system.

 

I take on board the "make one yourself" suggestion, but I don't know much Javescript and don't have time to make my own at this stage.

 

I want something that's free that I can just download and add to my site.

 

Any help appreciated!

 

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.