From: keatch
To: nepto
Subject: phpMyEdit - Image Upload patch [PARTIAL]
Date: Wed, 31 Mar 2004 00:27:28 +0200
Hi nepto, I'm from Italy.
I'm using phpMyEdit and I need a basic image upload functionality, no thumbnails
required.
All I want, is that PME is able to upload a file that the user can select via a
file_upload input (button Browse...) and that PME store the filename in the
record.
Searching in the bugs, I've tried the patches / triggers that are in the page.
I've tried to merge them in the main class. The first result is still limited but
fullfit my needs.
The line that I followed is this:
[Consideration of correctness apart]
1) I've added a new type (image) to the fields definitions
In the display_add_record , if PME detect this type of fields output
2) In the do_add_record , if the record is type "image" , it write the value of
the userfilename in the newvals array at the correct locations, recovering it
from the HTTP_POST_FILES (global at the start of the procedure)
3) I've used with no hack other than changing two variables the image_upload.php
the is in this page http://platon.sk/projects/bug_view_advanced_page.php?f_bug_id=29
(Great function!!!)
After that the file is uploaded to the directory specified in the image_upload
script, and the name in the database, so it is usable to show the image in the
LIST mode.
In this type, i've defined a new type of field, name 'image'. At the moment
it has no options, but, some useful could be something like
'remote_directory'
'max_size'
Don't know if you are working on this, but below is attached my patch against the
official 5.4 release. I know that this is not a great stilistical solution, and
require that you have to use a before trigger external to PME, but I could be a
starting point,after that an Image type is useful in some cases.
An example of record definition is:
$opts['fdd']['foto'] = array(
'name' => 'Foto',
'select' => 'T',
'maxlen' => 65535,
'textarea' => array(
'rows' => 5,
'cols' => 50),
'required' => true,
'sort' => true,
'image' => true,
'escape' => false,
'sql|L' => 'concat("")',
);
and the trigger
$opts['triggers']['insert']['before'] = 'image_up.php';
I attach also an updated translation of the ITALIAN language.
Hope this could help.
--
Raffaele Spangaro
Eurika s.r.l - Innovazione Tecnologica