Search engine

Question by irina:
Hi, I i need a php script to design a website were people can upload images and vote?

Its more like a contest, whoever wins gets a contract with a t-shirt company. But for this, people need to be able to upload the art and everyone should be able to vote for their favs.

This is for a private celebration so i cannot use google images or something like that, does anyone know of a php script that I can use?


——————————————

Answer by just “JR”
For uploading images:
UPLOADING FILES

The
type FILE will show an input field and a “browse” button.
Clicking the browse button will grant the user to choose a file to
upload.
Clicking the submit will submit the form to this same file.

Your “upfiles.php”:

function UploadOne($ fname)
{
$ uploaddir = 'uploadedfiles/';
if (is_uploaded_file($ fname['tmp_name']))
{
$ filname = basename($ fname['name']);
$ uploadfile = $ uploaddir . basename($ fname['name']);
if (move_uploaded_file ($ fname['tmp_name'], $ uploadfile))
$ res = "File " . $ filname . " was successfully uploaded and stored.
“;
else
$ res = “Could not move “.$ fname['tmp_name'].” to “.$ uploadfile.”
“;
}
else
$ res = “File “.$ fname['name'].” failed to upload.”;
return ($ res);
}
?>


if ($ _FILES['picture']['name'] != "")
{
$ res = UploadOne($ _FILES['picture']);
$ filname = $ _FILES['picture']['name'];
echo ($ res);
}
?>

UPLOADING FILES

Finally: you must create a directory where to put the uploaded files, and that
directory MUST have permissions set to 0777… (here called “uploadedfiles”)
(This set of functions works, but is NOT secure against viruses or “injection”:
the prevention of these is a much more complicated matter!)
—-
For voting: go to http://www.web2coders.com and download “thumbs up, thumbs down” free script.
Good luck!

——————————————
Know better? Leave your own answer in the comments!