How to use file uploads in a contact form?

Author Message

Marco Zinn

Monday 24 March 2008 5:13:14 am

Hello,

we're looking for a way to allow an (anonymous) user to upload one (or more) files trough a contact form.
The file needs to be stored on the server and/or sent to an admin as an email attachment.

I'm very sure, that a found a simple solution for this here somewhere or on the projects site, but i cannot find it even after half an hour of googl'ing.

Can please someone help me out with a link?
[EDIT: Finally found it here: http://ez.no/developer/contribs/applications/sendappform ... Is there a solution, that attached the file to the mail sent? ]

The alternative would be to let the user create a new object and trigger a notification mail; but i'm desperately looking for the other solution (information collectable file datatype).

I think, somebody did it to allow users to apply for open position (jobs) using a contact form page.

Thanks in Advance and Happy easter to everyone.

Marco
http://www.hyperroad-design.com

John Smith

Thursday 17 April 2008 2:58:35 am

Hi there,

Looking for the same thing on ezpublish 4.0 for a quite while now.

Did you get any solution.

If yes, please help me as well.

Much appreaciated.

Steven E. Bailey

Thursday 17 April 2008 4:16:41 am

Unless it has changed, this isn't standard fuctionality.

There is a datatype that we developed to do it but it is pretty old and I haven't looked at it in years:

http://ez.no/developer/contribs/datatypes/enhanced_ezbinaryfile

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

John Smith

Friday 18 April 2008 1:11:08 am

Hi Guys,

I am in a great problem to meet the requirment of multiple attachments in a form and then send it to an email.

Requirments:

1. Login Area.

2. Once the user logged in, the user can see the form with the the facility to attach multiple files and few other text fields.

3. Recipient should get the email having the attachments with the name of the user who sent the form by logging in.

Any help Appreciated.

Cheers.

Marco Zinn

Friday 18 April 2008 7:31:46 am

Just some information:

I tried the "sendAppForm" now on a 3.10 installation. It works, but it has some drawbacks (see my comment on http://ez.no/developer/contribs/applications/sendappform for now).

Please note, that the extension stores files on the server and only sends links to these files by email.

I will have a look at the enhanced ezbinaryfile datatype, too, because this may fit our needs better and seems to integrate better into the ez system.

Marco

Marco
http://www.hyperroad-design.com

John Smith

Monday 21 April 2008 8:39:20 am

Hi everybody,

I have had a look at the sendAppform extension, it worked fine, the only problem is it works for only one form, I need to set up 5 different forms and allow the user to choose any of them and send the data with the attachment.

Anyone????

Marco Zinn

Tuesday 22 April 2008 5:52:05 am

Hi,

I'm currently testing the enhanced ezbinary datatype ( http://ez.no/developer/contribs/datatypes/enhanced_ezbinaryfile ) on ez 3.10 and it works quite fine for me at the moment.

I think, as soon, as you need more than one form, this is a good solution.

Needs some PHP coding, too, to have the uploaded files mailed as attachments, but the code, that is supplied, works with ez 3.10.

Marco
http://www.hyperroad-design.com

Ismael Ruiz

Thursday 24 April 2008 3:30:35 am

Hi

I'm looking for a form where an anonymous user can upload one or more files.

I have tested on a eZ4 two solutions.

Here my system:

-ubuntu6.3 Server
-Apache/2.2.4 (Ubuntu)
-PHP/5.2.3-1
-Mysql5
-eZ4

Solution 1:
http://ez.no/developer/contribs/datatypes/enhanced_ezbinaryfile - proposed by Steven E. Bailey

It seems to work.I created a form with two upload files. The form runs and I receive a mail and an line is created in the admin interface.

Collection #21 for <Formulaire d’inscription en ligne pour acteurs (M/F) et figurants (M/F)>
Last modified: 24/04/2008 11:12 am, Anonymous User
Nom: aa
Prénom: aaaa
Nom d’Artiste :
GSM:
Tél. Privé:
Tél. Bureau:
e-mail 1:
e-mail 2:
Site web:
Adresse:
Profession:
Nationalité:
Date de naissance:
Taille:
Type morphologique:Musclé/sportif
Couleur cheveux :Noir
Couleur cheveux autre:
Type cheveux:Long
Type cheveux autre:
Couleur yeux:Noir
Couleur yeux autre:
Robe:
Chemisier:
T-Shirt F:
Pantalon F:
Pointure F:
Chemise:
Tour de cou:
T-Shirt H:
Pantalon H:
Pointure H:
Langue maternelle: Not specified
Autres langues parlées couramment: Not specified
Autres langues (notions): Not specified
couper vos cheuveux: oui
colorer vos cheveux: oui
jouer en sous-vêtements: oui
jouer nu(e): oui
jouer dans des scènes érotiques: oui
Permis de conduire (voiture): oui
Permis de conduire (moto): oui
Permis de conduire (camion): oui
Equitation: oui
Danse: oui
Danse oui:
Chant: oui
Chant oui:
Instrument de musique: oui
Instrument de musique oui:
Autres aptitudes:
CV: WG_logo.png succesfully uploaded.
Photo: white_opac_50.png succesfully uploaded.

It says that the files has been uploaded successfully but there is no file stored on my server. I have looked recursive in these directories (/var/www/site_name/var/storage and /var/www/site_name/var/ezwebin_site/storage).

Can somebody help find out if the files are really uploaded and if yes where the files are uploaded?

THX

Solution 2:
http://ez.no/developer/contribs/applications/sendappform

This does not run at all. Here the ‘Warnings and Error messages’

Warning: include_once(lib/ezutils/classes/ezini.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/obskura/extension/sendAppForm/modules/sendAppForm/send.php on line 10

Warning: include_once() [function.include]: Failed opening 'lib/ezutils/classes/ezini.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/obskura/extension/sendAppForm/modules/sendAppForm/send.php on line 10

Warning: include_once(lib/ezutils/classes/ezmail.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/obskura/extension/sendAppForm/modules/sendAppForm/send.php on line 12

Warning: include_once() [function.include]: Failed opening 'lib/ezutils/classes/ezmail.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/obskura/extension/sendAppForm/modules/sendAppForm/send.php on line 12

Warning: include_once(lib/ezutils/classes/ezmailtransport.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/obskura/extension/sendAppForm/modules/sendAppForm/send.php on line 14

Warning: include_once() [function.include]: Failed opening 'lib/ezutils/classes/ezmailtransport.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/obskura/extension/sendAppForm/modules/sendAppForm/send.php on line 14

Fatal error: Class 'eZINI' not found in /var/www/obskura/extension/sendAppForm/modules/sendAppForm/send.php on line 18

The files are accessible!
This solution is not so flexible as the Solution 1 but it can help me if it works.

THX if somebody knows what is not ok on my server.

Ismael Ruiz

Thursday 24 April 2008 3:31:10 am

False post.
Sorry

Steven E. Bailey

Thursday 24 April 2008 4:35:57 am

The uploaded files for the enhanced_ezbinaryfile are stored in:

var/<siteaccess>/storage/original/collected/<filetype>

At least that's what I wrote in the documentation....

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Steven E. Bailey

Thursday 24 April 2008 4:40:43 am

@Marco Re: Needs some PHP coding, too, to have the uploaded files mailed as attachments, but the code, that is supplied, works with ez 3.10.

The kernel hack should take care of the mailing... It doesn't?

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Ismael Ruiz

Friday 25 April 2008 2:29:49 am

Hi.

Thak you for the answer Steven.

But there is no directory called 'collected' in my var/<siteaccess>/storage/original/.
Have I first to create the directory?

Sorry, but where is your documentation to find ?

THX

Steven E. Bailey

Friday 25 April 2008 9:07:40 am

There is an install.txt and readme.txt in the docs directory of the extension.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Marco Zinn

Friday 25 April 2008 9:17:16 am

Yes, the code modification, that was necessary is quite well documented. I just wanted to note, that it's not completely "out of the box".
It integrates better with ez in general (than sendAppForm).

Wishlist (while you are here, Steven):
- Of course: Links from the "Information collection Admin GUI" to the uploaded files
- Deleting an Information Collection did not delete any of the uploaded files

Besides that: Great work!

Marco
http://www.hyperroad-design.com

sinisa podunavac

Thursday 29 May 2008 8:57:01 pm

Hi Marco,

Did you make it work in ezpublish 4.0?

You mentioned some code modifications. Would you mind publishing it somewhere so we can test and use it as well?

Thanks

Kind regards
Sid
+44 7976 762 431

Wei Dai

Thursday 24 July 2008 12:35:03 am

Will it be upgraded for eZ 4?

I got Fatal error: Call to undefined method EnhancedeZBinaryFileType::definition() in D:\bysoft\kernel\classes\ezpersistentobject.php on line 188
Fatal error: eZ Publish did not finish its request

And a series of warning of

Declaration of EnhancedeZBinaryFileType::... not be compatible with that of eZDataType...

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Thursday 24 July 2008 3:31:10 am

Ok. the fetal error is because I just add the new datatype on an existing class and object.

After I defined new class and created object with the enhancedezbinaryfile datatype, the fetal error was gone.

But the file seem didn't get uploaded, I didn't get "the files has been uploaded successfully" after submit. No error message also.

As to the strict warning messages are still there. At first, I thought it may just because the difference between PHP4 and PHP5 on pass the objects as arguments(in PHP5, objects are always passed as reference). So, I just change the function declarations to the exact the same as in eZDataType. And the warnings are gone. Am I doing it right?

I think it really comes down this question, is the enhancedezbinaryfile full compatible with eZ 4?

Certified eZ Publish 4 developer looking for develop information & collaboration.

Wei Dai

Wednesday 06 August 2008 12:01:39 am

Ok. I alerted the enchancedbinaryfile extension. I think it fully works on eZ4 now.

Certified eZ Publish 4 developer looking for develop information & collaboration.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.