eZ Community » Forums » Developer » How to use file uploads in a contact...
expandshrink

How to use file uploads in a contact form?

How to use file uploads in a contact form?

Monday 24 March 2008 1:13:14 pm - 17 replies

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.

Modified on Monday 24 March 2008 1:40:27 pm by Marco Zinn

Thursday 17 April 2008 11: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.

Thursday 17 April 2008 1:16:41 pm

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

Friday 18 April 2008 10: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.

Modified on Friday 18 April 2008 10:18:41 am by John Smith

Friday 18 April 2008 4:31:46 pm

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

Monday 21 April 2008 5:39:20 pm

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????

Tuesday 22 April 2008 2:52:05 pm

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.

Thursday 24 April 2008 12:30:35 pm

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.

Thursday 24 April 2008 12:31:10 pm

False post.
Sorry

Modified on Thursday 24 April 2008 12:33:25 pm by Ismael Ruiz

Thursday 24 April 2008 1:35:57 pm

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....

Modified on Thursday 24 April 2008 1:37:42 pm by Steven E Bailey

Thursday 24 April 2008 1:40:43 pm

@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?

Friday 25 April 2008 11: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

Friday 25 April 2008 6:07:40 pm

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

Friday 25 April 2008 6:17:16 pm

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!

Friday 30 May 2008 5:57:01 am

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

Thursday 24 July 2008 9: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...

Thursday 24 July 2008 12:31:10 pm

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?

Wednesday 06 August 2008 9:01:39 am

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

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from