Does anyone know how I can upload photos to ZP from a mobile phone? I have a Blackberry and tried to upload a photo but it said I must enter a folder to upload to or something.
Can you run FTP from your Blackberry? If so, use it. If not you will probably have to upload your Blackberry images to your PC then upload them to the album form there.
That's a really good idea. But after looking for an FTP client for my Blackberry I was only able to turn up one program, and it would cost $35 to purchase it. It's not really worth it at that point. I'm gonna see if I can determine why ZP throws an error when I try to upload via my phone.
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>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.
* Moved the extension check out of the size check loop. Thanks Sandro Juergensen
* Added lower casing the extension check
* Added converting spaces in filename to underscores
2000-05-31:
* original script released */ ?>
Upload Photo to ZenGallery
<?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 "<h1>ERRORWrong password "; unlink($imgfile); exit(); }
/*== 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 "
ERROR
Image 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
/*== 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
Easiest is to put the metadata into IPTC fields in the image. Otherwise your upload script needs to create an image object, set the values, then save the object.
When someone creates that...;-) Sorry, I won't as I don't have any mobile device. But there are surely some FTP apps for your device you can use (I guess on iDevices and other smart phones with proper browsers our backend would actually work as well).
Comments
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>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
* Added lower casing the extension check
* Added converting spaces in filename to underscores
2000-05-31:
* original script released
*/
?>
Upload Photo to ZenGallery
<?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 "<h1>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 "
ERROR
Image Extension Unknown.";
print "
Please upload only a JPEG image with the extension .jpg or .jpeg ONLY
\n";";
print "The file you uploaded had the following extension: $pext
/*== 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==*/
}
?>
Upload to ZenPhoto
" method="POST" enctype="multipart/form-data">Click browse to upload a local file
<?php
/*== FUNCTIONS ==*/
function getFileExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
?>
`