Hi all, I have - I guess - a very basic problem. I want to upload a file through a web form. It is all still very basic. here is is my form: <form name="" action="galleries/uploadImage.dtml" enctype="multipart/form-data"> <div align="center"> <p> <input type="file" name="image" enctype="multipart/form-data"> </p> <p> <input type="submit" name="Button" value="upload"> </p> </div> </form> and this is the "uploadImage.dtml" Method: <dtml-call "manage_addImage('bild',image,'TEST')"> When I choose an Image on my Local HD and hit the "upload" button, all that happen is that I get a browser window with th URL "http://floundjan.homeip.net:13080/admin/galleries/uploadImage.dtml?image=C%3..." (that depends on the file I chose, of course) But no Image is created in the Zope DB. If I press the reload button on that URL a image with the right ID and title is created, but it is empty (42 bytes). Can someone please tell me what I am doing wrong? I already searched the mailing list archive and all I could find in the How-TOs. I even have the beehive Zope-Book, but couldn't find anything. Many, many thanks in advance... Jan Jan@MountainbikeHQ.de http://www.MountainbikeHQ.de - Your home for DH, DS and CC Mountainbiking
Hi Jean, I think your form needs a method="post" guete sunntig Robert ----- Original Message ----- From: "Jan Lentfer" <jan.lentfer@web.de> To: <Zope@zope.org> Sent: Saturday, September 15, 2001 11:44 PM Subject: [Zope] Uploading Images from a web from
Hi all,
I have - I guess - a very basic problem. I want to upload a file through a web form. It is all still very basic.
here is is my form: <form name="" action="galleries/uploadImage.dtml" enctype="multipart/form-data"> <div align="center"> <p> <input type="file" name="image" enctype="multipart/form-data"> </p> <p> <input type="submit" name="Button" value="upload"> </p> </div> </form>
and this is the "uploadImage.dtml" Method: <dtml-call "manage_addImage('bild',image,'TEST')">
When I choose an Image on my Local HD and hit the "upload" button, all that happen is that I get a browser window with th URL
"http://floundjan.homeip.net:13080/admin/galleries/uploadImage.dtml?image=C% 3A%5CEigene+Dateien%5CEigene+Bilder%5Ceisb%E4r.jpg&Button=upload"
(that depends on the file I chose, of course) But no Image is created in the Zope DB. If I press the reload button on that URL a image with the right ID and title is created, but it is empty (42 bytes).
Can someone please tell me what I am doing wrong? I already searched the mailing list archive and all I could find in the How-TOs. I even have the beehive Zope-Book, but couldn't find anything.
Many, many thanks in advance...
Jan
Jan@MountainbikeHQ.de http://www.MountainbikeHQ.de - Your home for DH, DS and CC Mountainbiking
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Don't forget method="post" <form name="" action="galleries/uploadImage.dtml" method="post" enctype="multipart/form-data"> ;-) -steve On Saturday, September 15, 2001, at 04:44 PM, Jan Lentfer wrote:
Hi all,
I have - I guess - a very basic problem. I want to upload a file through a web form. It is all still very basic.
here is is my form: <form name="" action="galleries/uploadImage.dtml" enctype="multipart/form-data"> <div align="center"> <p> <input type="file" name="image" enctype="multipart/form-data"> </p> <p> <input type="submit" name="Button" value="upload"> </p> </div> </form>
At 19:56 15.09.2001 -0500, Steve Spicklemire wrote:
Don't forget method="post"
<form name="" action="galleries/uploadImage.dtml" method="post" enctype="multipart/form-data">
;-)
-steve
Ooops, I must have lost that tag when I was playing around with the code. Anyway, it works now, thanks a lot. Which brings up a new question. Can I somehow determine the filename of the choosen file? When I use the tag <input type="file" name="image"> "image" will return the path and filename on the local FS. Is it possible to read out just the filename without the path. Is that transmitted? Many thanks in advance, Jan Jan@MountainbikeHQ.de http://www.MountainbikeHQ.de - Your home for DH, DS and CC Mountainbiking
Hi Jan, You can do (essentially) what the Zope File object does: filename=file.filename filename=filename[max(string.rfind(filename, '/'), string.rfind(filename, '\\'), string.rfind(filename, ':'), )+1:] -steve On Sunday, September 16, 2001, at 12:50 AM, Jan Lentfer wrote:
At 19:56 15.09.2001 -0500, Steve Spicklemire wrote:
Don't forget method="post"
<form name="" action="galleries/uploadImage.dtml" method="post" enctype="multipart/form-data">
;-)
-steve
Ooops, I must have lost that tag when I was playing around with the code. Anyway, it works now, thanks a lot. Which brings up a new question. Can I somehow determine the filename of the choosen file?
When I use the tag <input type="file" name="image"> "image" will return the path and filename on the local FS. Is it possible to read out just the filename without the path. Is that transmitted?
Many thanks in advance,
Steve Spicklemire wrote:
Hi Jan,
You can do (essentially) what the Zope File object does:
filename=file.filename filename=filename[max(string.rfind(filename, '/'), string.rfind(filename, '\\'), string.rfind(filename, ':'), )+1:]
-steve
That's python, right? Could you tell me how I can integrate this into my DTML-method? At the moment my DTML-Method looks like this: --------------------- <dtml-call "_[gallerypath].manage_addImage(image.filename,image)"> <dtml-call "RESPONSE.redirect ('../managegalleries.htm')"> ---------------------- This works if I use Netscape on Linux, but doesn't with MSIE on Win2K, I guess because of the \-Syntax. I am not very familar with Python, but I finally bought a book (Addison-Weseley: Python 2). If I just had the time to read it ;-) Thanks a lot in advance, Jan -- Jan@MountainbikeHQ.de http://www.MountainbikeHQ.de - Your home for DH, DS and CC Mountainbiking
Ahh.. I didn't know you were calling manage_addImage! Just pass '' for the id, and manage_addImage will do the rest (I swiped the code I sent from the implementation of manage_addImage, so it already does this for you.) so: <dtml-call "_[gallerypath].manage_addImage('',image)"> <dtml-call "RESPONSE.redirect ('../managegalleries.htm')"> should just work. -steve On Sunday, September 16, 2001, at 10:13 AM, Jan Lentfer wrote:
Steve Spicklemire wrote:
Hi Jan,
You can do (essentially) what the Zope File object does:
filename=file.filename filename=filename[max(string.rfind(filename, '/'), string.rfind(filename, '\\'), string.rfind(filename, ':'), )+1:]
-steve
That's python, right?
Could you tell me how I can integrate this into my DTML-method?
At the moment my DTML-Method looks like this:
---------------------
<dtml-call "_[gallerypath].manage_addImage(image.filename,image)"> <dtml-call "RESPONSE.redirect ('../managegalleries.htm')">
----------------------
This works if I use Netscape on Linux, but doesn't with MSIE on Win2K, I guess because of the \-Syntax.
I am not very familar with Python, but I finally bought a book (Addison-Weseley: Python 2). If I just had the time to read it ;-)
Thanks a lot in advance,
Jan
-- Jan@MountainbikeHQ.de http://www.MountainbikeHQ.de - Your home for DH, DS and CC Mountainbiking
Steve Spicklemire wrote:
Ahh.. I didn't know you were calling manage_addImage! Just pass '' for the id, and manage_addImage will do the rest (I swiped the code I sent from the implementation of manage_addImage, so it already does this for you.)
so:
<dtml-call "_[gallerypath].manage_addImage('',image)"> <dtml-call "RESPONSE.redirect ('../managegalleries.htm')">
should just work.
-steve
Yep, that's it ;-). Sometimes it's that easy..... Thanks A LOT. Jan -- Jan@MountainbikeHQ.de http://www.MountainbikeHQ.de - Your home for DH, DS and CC Mountainbiking
participants (3)
-
Jan Lentfer -
Robert Rottermann -
Steve Spicklemire