Single photo upload is pretty easy to do with php:
http://www.blazonry.com/scripting/upload-size.php
I wonder what you need to do to be able to give a title and a description to the image. Title should be easy by adding a title field to upload page and renaming the file accordingly. Here's some ideas how to customize the upload code from above site:
`
<?php
/* ====================================================================
* Copyright (c) 2000 Astonish Inc.
* www.blazonry.com/scripting/upload-size.php
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR [code][/code]AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
/*
SCRIPT CHANGE LOG:
2009-02-28
* Modifications to suite zengallery
2002-06-10:
* Plugged security hole with is_uploaded_file() function. Thanks much
to Timothy Rieder for pointing this out.
2001-01-10:
* Added line of text letting user know what extension was read in
when denying a file upload. Suggestion by Sandro Juergensen.
2001-01-09:
* Removed GIF support from script to not encourage the use of
silly patents. For more info: http://www.gnu.org/philosophy/gif.html
* Cleaned up the code and comments
* Moved the extension check out of the size check loop.
Thanks Sandro Juergensen <forgetit@sandlatscher.de>
* Added lower casing the extension check
* Added converting spaces in filename to underscores
2000-05-31:
* original script released
*/
?>
<html>
<head>
<title>Upload Photo to ZenGallery</title>
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
/* SUBMITTED INFORMATION - use what you need
* temporary filename (pointer): $imgfile
* original filename : $imgfile_name
* size of uploaded file : $imgfile_size
* mime-type of uploaded file : $imgfile_type
*/
if ($_POST['password']!='ADD_PASSWORD_HERE_REALLY_SIMPLE_SECURITY')
{
print "ERRORWrong password
";
unlink($imgfile);
exit();
}
if ($_FILES["file"]["error"] > 0) {
echo "Error: " . $_FILES["file"]["error"] . "
";
exit();
}
else {
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
$imgfile = $_FILES["file"]["tmp_name"];
$imgfile_name = $_FILES["file"]["name"];
$imgfile_size = $_FILES["file"]["size"];
$imgfile_type = $_FILES["file"]["type"];
}
/*== upload directory where the file will be stored
relative to where script is run ==*/
$uploaddir = "albums/Mobile Album";
/*== get file extension (fn at bottom of script) ==*/
/*== checks to see if image file, if not do not allow upload ==*/
$pext = getFileExtension($imgfile_name);
$pext = strtolower($pext);
if (($pext != "jpg") && ($pext != "jpeg"))
{
print "ERRORImage Extension Unknown.
";
print "Please upload only a JPEG image with the extension .jpg or .jpeg ONLY
";
print "The file you uploaded had the following extension: $pext
\n";
/*== delete uploaded file ==*/
unlink($imgfile);
exit();
}
/*== setup final file location and name ==*/
/*== change spaces to underscores in filename ==*/
$final_filename = str_replace(" ", "_", $imgfile_name);
/*== ensure file does not have .jpeg extension ==*/
$final_filename = strtoupper($final_filename);
$final_filename = str_replace("JPEG", "JPG", $final_filename);
$newfile = $uploaddir . "/$final_filename";
/*== do extra security check to prevent malicious abuse==*/
if (is_uploaded_file($imgfile))
{
/*== move file to proper directory ==*/
if (!copy($imgfile,"$newfile"))
{
/*== if an error occurs the file could not
be written, read or possibly does not exist ==*/
print "Error Uploading File.";
exit();
}
}
/*== delete the temporary uploaded file ==*/
unlink($imgfile);
print("File uploaded successfully!");
/*== DO WHATEVER ELSE YOU WANT
SUCH AS INSERT DATA INTO A DATABASE
ONE COULD HERE ADD DESCRIPTION==*/
}
?>
</head>
<body bgcolor="#FFFFFF">
Upload to ZenPhoto
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
<label for="password">Password:</label>
<input type="password" name="password"/>
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<font size="1">Click browse to upload a local file</font>
<input type="submit" value="Upload Image"/>
</form>
</body>
</html>
<?php
/*== FUNCTIONS ==*/
function getFileExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
?>
`