This is what I am doing ATM for image uploads in add_item and admin_item.
It is not pretty and there is no error or file type checking but it is going
to do fine for me while I get the current site I am working on ready for a
November release. I thank everyone who ignored my last post on this which
made no sense at all. I was trying to make something much more complicated
than what I needed. If anyone happens to find this helpful groovy. All
that I ask is that any improvements are made available.
Make sure to set enctype="multipart/form-data" on each screen or this won't
work. Also make sure that php will be able to write to image/items
directory. I am using each of the below snippets as an include. One is for
the add_item and admin_item screens, the other for the corresponding
actions.
add_image_action:
<?
// set max image size before getting images
$max_file_size = 200 * 1024; // 200K -- Move this to global?
print("<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"" .
$max_file_size . "\">");
?>
add_image_screen:
<?
// Lets add graphics here
function copy_picture($picture, $name) // gotta be a better way, once I
find it move to std_lib
{
copy($picture, APPLICATION_ROOT . "public_html/images/items/" . $name);
}
do
{
if (file_exists($inputThumbnail))
{
copy_picture($inputThumbnail, $inputThumbnail_name);
}
if (file_exists($inputGraphic))
{
copy_picture($inputGraphic, $inputGraphic_name);
}
if (file_exists($inputLargeGraphic))
{
copy_picture($inputLargeGraphic, $inputLargeGraphic_name);
}
} while(false);
$inputThumbnail = $inputThumbnail_name;
$inputGraphic = $inputGraphic_name;
$inputLargeGraphic = $inputLargeGraphic_name;
?>
-------------------------------------------------
Chuck Gartland || [EMAIL PROTECTED]
Project 27 || www.project27.com
1836 Palm Avenue || 808 465-1381
Pearl City, HI 96782 || GMT -10:00 hours
-------------------------------------------------
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Site: http://www.working-dogs.com/freetrade/
Problems?: [EMAIL PROTECTED]