[Zope] Unable to upload images from client to server
Kelvin Cheong
kcheong@vcn.com.my
Fri, 07 Jul 2000 02:41:22 GMT
Hello All!
I have this problem with "UPLOADING".
In my HTML form (DTML-embedded-Document) I have data and images to insert
into a mySQL DATABASE. Therefore I'm calling SQL statements from my DTML
METHOD.
However, it seems the SQL insert command does not allow LOAD_FILE procedure
as does the SQL update command e.g.:
UPDATE table_name
SET blob_column=LOAD_FILE('full_path_of_file') WHERE
table_column='table_column value'
So I had to resort to using TWO separate SQL methods :
1) to insert the "data" alone into the database first, from the form;
2) then another to insert the image of the same form using the SQL "update"
command, verified my the data record's unique id.
All this works fine but this method does not work with the
<...ENCTYPE="multipart/form-data"...> value at the html form header.
Instead it only works with
<...ENCTYPE="application/w-xxx-form-urlencoded"...>. If I use
"multipart/form-data" it will enter the string of the command
LOAD_FILE('...file...') instead of the actual image contents. Why is this?
This is only one small part which I'm puzzled about as this method would
only allow images on the server's harddisk to be uploaded. The main concern
is UPLOADING from the client.
Having mentioned so, the next problem I'm facing is uploading the file onto
the Zope Server from the client. Having searched on the net, it appears
that I will have to use CGI's on my server side to temporarily grab the
files contents and place it somewhere. Is there anyway to use DTML without
the involvement of external CGI's?
Also, it seems that if I had to do this on Zope, it will require me to use
Python. Which of course sounds hard.
Then the questions arise regarding CGI's (IF IT REALLY IS REQUIRED):
1) How on earth do I do this?;
2) What if there were multiple users uploading files at the same time, then
what happens to the single temporary file which stores the uploaded files'
contents.
3) If I were to use a /cgi-bin/... how will that relate to where ZOPE is
installed, in other words, would the directory structures get confusing?
I'm not a hopeless programmer but neither am I close to even "quite good".
Learning won't be a problem, but I'll need the answers quick, as I do not
have the time in my hands. Can anyone please help me out?
I've looked in discussion forums and the DTML reference, as I have said I'm
practically a beginner programmer, and was unable to understand even half
of what had been posted.
VCN - The Leader In Corporate Communication Solutions
Visit our website at http://www.vcn.com.my.
or http://www.vcnlinux.com