Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
March 20, 2010, 07:41:27 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Wollen Sie dem Website Baker Team beitreten?
Nähere Informationen finden Sie unter
hier
und auf unserer
neuen Webseite
.
110551
Posts in
15964
Topics by
9310
Members
Latest Member:
stevenris10
WebsiteBaker Community Forum
English
Modules
(Moderators:
Argos
,
BerndJM
)
FormX - Forms with file captcha/upload/calendar/mail attachment/submission
Pages:
[
1
]
2
3
...
8
Author
Topic: FormX - Forms with file captcha/upload/calendar/mail attachment/submission (Read 20571 times)
sharmpro
Offline
Posts: 64
FormX - Forms with file captcha/upload/calendar/mail attachment/submission
«
on:
June 13, 2008, 03:02:13 AM »
Hi,
I needed to upload a file and attach it to an email. Here is where everything started....
Got some ideas from existing modules and snippet and now I'd like some feedback.
- NEW VERSION 2.4.8 -
In the project pipeline:
* Sent mail to recipient based on user selections (opt1 ->
email1@yourdomain.com
, opt2 -> email2...)
* Select field with default option amd display of another string than the value itself
Known issues:
* CSS definition for checkbox and radio fields still to complete
- Some code optimization
- Captcha got * of required
- .CSS cleanup and fixes
- Fix 'not saving field' if new installation
- Help w/tooltip on each form field
- Folder /media wrong chmod
- Drag+Dop for Filed order definition
- Order of filelds now can be done with Drag&Drop
- New .css definition for frontend
BE CAREFULL IF YOU ALREADY USED ONE!
- Started Help page
- Cleaned up Backend and use of Template
- Resolve some security issue
- Now uses jsCalendar from standard WB distribution
- Removed from backend unused _html fields
- Fixed Bug - Securty issues - Sanitized some params
- Fixed bug - Install error
- Fixed bug - Multiple file upload
- Fixed bug - Submissions not stored in database
- Fixed Max file size bug (was not saved) Thanks to Aldus.
- Submission data saved into serialized db field
- File Upload Required works!
- File Upload chmod (0666 for direct link)
- File uploaded linked in submission (backend)
- Added Select email_from as name <address>
- Added File Type to Upload (jpg,tif,png,pdf,....)
- Automatic creation of upload folder
- Bug fix file view.php - $err
- Added file attachments
- Added Date field
- Added File Upload
- Added File Attach to email
Features:
Field filename
- PEAR File Uploader
- File Upload chmod (0666 for direct link)
- File uploaded linked in submission (backend)
- Automatic creation of upload folder
- Added Select email_from as name <address>
- Added File Type to Upload (jpg,tif,png,pdf,....)
- MAXFILESIZE defined in settings.
- folder (from /media) to store file
- if attach file to email
Field date
- date format
Form submission:
- return to page#section
After submission the form return to the same page#session in order to show the user the same section he submitted from.
Please fell free to suggest and integrate, will be nice (one day) to have a solid and complete 'form' module with all the feature we think it should have...
Stefano
«
Last Edit: October 25, 2008, 12:31:56 AM by sharmpro
»
Logged
SharmPRO
http://www.sharmpro.com
http://www.jcwebden.com
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file upload and file attach to email
«
Reply #1 on:
September 04, 2008, 11:49:16 AM »
Hello Stefano,
I try to implement your Module, but I get a problem again and again.
Notice
: Use
of undefined constant err
-
assumed
'err'
in
/
mnt
/
web4
/
12
/
33
/
52843xx
/
htdocs
/
xxffxx
/
modules
/
formx
/
view
.
php on line 137
I looked into the view.php but I don't seem to find the cause of the problem.
Anyway, the e-mai is comming to the specified e-mail address but without the file "Upload faild" is what I get.
Do you have any suggestions?
Best Regards,
Stefek
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
aldus
Addons Team
Offline
Posts: 1018
Re: FormX - Forms with file upload and file attach to email
«
Reply #2 on:
September 04, 2008, 01:16:47 PM »
Hello Stefek
There is a missing "$" in the line before the "err", so the correct line should be like
Code:
<?php
/**
* @version 0.1.1
*/
echo
"<br><b>There was an error uploading the file: "
.
$_FILES
[
'field'
.
$fileid
][
'error'
].
" "
.
$err
.
", please try again!<b><br>"
;
?>
Regards
Aldus
Logged
57 65 62 73 69 74 65 20 42 61 6B 65 72 20 72 6F 63 6B 73 21
sharmpro
Offline
Posts: 64
Re: FormX - Forms with file upload and file attach to email
«
Reply #3 on:
September 04, 2008, 01:52:12 PM »
Hi,
sorry for the bug I forgot into the module.
Yes the $err is the problem.
I repacked the file v1.1b with the fix.
Regards
Stefano
«
Last Edit: September 04, 2008, 02:24:40 PM by sharmpro
»
Logged
SharmPRO
http://www.sharmpro.com
http://www.jcwebden.com
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file upload and file attach to email
«
Reply #4 on:
September 04, 2008, 01:59:48 PM »
Hello!
Thank you Aldus.
This fixed the problem.
But I still have a upload proplem.
The massage goes like this:
There was an error uploading the file: 2 UPLOAD_ERR_FORM_SIZ
E, please try again!
Any suggestion on this issue, Stefano?
Best Regards,
Stefek
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
sharmpro
Offline
Posts: 64
Re: FormX - Forms with file upload and file attach to email
«
Reply #5 on:
September 04, 2008, 02:19:54 PM »
Hi,
did you specified "Max upload file size Kb: 1024"? Unfortunatelly the module wrongly consider "bytes" not "Kb"..
Try once to specify this value in bytes.
Already fixed in Ver 1.1.c
Regards,
Stefano
«
Last Edit: September 04, 2008, 02:24:00 PM by sharmpro
»
Logged
SharmPRO
http://www.sharmpro.com
http://www.jcwebden.com
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file upload and file attach to email
«
Reply #6 on:
September 04, 2008, 02:45:41 PM »
Quote from: sharmpro on September 04, 2008, 02:19:54 PM
did you specified "Max upload file size Kb: 1024"? Unfortunatelly the module wrongly consider "bytes" not "Kb"..
All right.
I specified the byte size to 999999. So this should be enough.
But another NOTE appears. It goes like this:
Code:
Warning: move_uploaded_file(/mnt/web4/12/33/---/mnt/web4/12/33/5284333/htdocs/aschaffenburg/res/bewerbungsfotos/04092008020955-logo.jpg)
[function.move-uploaded-file]: failed to open stream: No such file or directory in
mnt/web4/12/33/---/modules/formx/view.php on line 118
Warning: move_uploaded_file() [function.move-uploaded-file]:
Unable to move '/mnt/shared/tmp/phpRxaiyV' to '/mnt/web4/12/33---/mnt/web4/12/33/5284333/htdocs/aschaffenburg/res/bewerbungsfotos/04092008020955-logo.jpg'
in /mnt/web4/12/33/---/modules/formx/view.php on line 118
There was an error uploading the file: 0 MOVING_FILE, please try again!
That's pretty strange to me
Regards,
Stefek
BTW: After I get this running, this will be my preffered form module. I think file attachement should be standard.
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
erpe
Offline
Posts: 1738
Re: FormX - Forms with file upload and file attach to email
«
Reply #7 on:
September 04, 2008, 03:07:48 PM »
Hi
unfortunately I have to confirm: I get the same error.
rgds
erpe
Logged
Search on
All Modules And Snippets Project (AMASP)
Be part of the
Tutorials-Project
sharmpro
Offline
Posts: 64
Re: FormX - Forms with file upload and file attach to email
«
Reply #8 on:
September 04, 2008, 03:19:48 PM »
Hi,
is the "Upload Files Folder:" MUST starting with
/media/
your_folder/
The
/media/
your_folder/ must be created manually.
Stefano
Logged
SharmPRO
http://www.sharmpro.com
http://www.jcwebden.com
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file upload and file attach to email
«
Reply #9 on:
September 04, 2008, 03:47:43 PM »
Quote from: sharmpro on September 04, 2008, 03:19:48 PM
Hi,
is the "Upload Files Folder:" MUST starting with
/media/
your_folder/
The
/media/
your_folder/ must be created manually.
Stefano
Hello Stefano.
My current "media" folder has the name "res".
Now I createda second folder "media" and set the permission to 777. (for testing)
Unfortunately it dosen't work for me.
I get the same Note as before.
What could fix the problemo?
Best Regars,
Stefek
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
aldus
Addons Team
Offline
Posts: 1018
Re: FormX - Forms with file upload and file attach to email
«
Reply #10 on:
September 04, 2008, 04:04:19 PM »
Reading the errormessage form Stefek carefully, i regonize a missing "/" slash in the pathnames:
Code:
/mnt/web4/12/33---/
and
Code:
/mnt/web4/12/33/---/
As this comes up at the begin of the pathnames i asumee it have to do with WB_PATH ...
as the "htdocs"-folder comes some subfolders later. Could be a server-admin typo ...
Edit
I also remember a client with php but no permissions to upload files via PHP ... could be also the (web-)package.
Regards
Aldus
«
Last Edit: September 04, 2008, 04:07:51 PM by aldus
»
Logged
57 65 62 73 69 74 65 20 42 61 6B 65 72 20 72 6F 63 6B 73 21
erpe
Offline
Posts: 1738
Re: FormX - Forms with file upload and file attach to email
«
Reply #11 on:
September 04, 2008, 04:27:43 PM »
Works now.
Set path in options like:
Code:
/media/name/file
(path file created in media) and form loads up your file as (for example):
file04092008040935-yourfile.txt
But don't ask me why!!
rgds
erpe
Edit: Do not set "slash" after "file" in the path: /media/name/file !!
«
Last Edit: September 04, 2008, 05:09:52 PM by erpe
»
Logged
Search on
All Modules And Snippets Project (AMASP)
Be part of the
Tutorials-Project
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file upload and file attach to email
«
Reply #12 on:
September 04, 2008, 04:43:07 PM »
Quote from: aldus on September 04, 2008, 04:04:19 PM
Reading the errormessage form Stefek carefully...
Hello Aldus, I just have shorten up the path.
The (my new) error goes like this (I applied Erpe's suggestion):
Warning: move_uploaded_file(/mnt/web4/12/33/5284/htdocs/myfolder/mnt/web4/12/33/5284333/htdocs/aschaffenburg/media/bewerbungsfotos/file04092008040942-dsc_0091-2.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /mnt/web4/12/33/5284/htdocs/myfolder/modules/formx/view.php on line 118
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/mnt/shared/tmp/phpAZaqSg' to '/mnt/web4/12/33/5284/htdocs/myfolder/mnt/web4/12/33/5284333/htdocs/aschaffenburg/media/bewerbungsfotos/file04092008040942-dsc_0091-2.jpg' in /mnt/web4/12/33/5284/htdocs/myfolder/modules/formx/view.php on line 118
Would be great if this could be fixed.
I have another "fork" working (but with some issues).
This one moves the pictuers correctly. The only "bug": it is based on a old version of the Form Module
http://www.websitebaker2.org/forum/index.php/topic,6652.msg41490.html
Never mind wich can be fixed. If someone can help me it would be great!
Best Regards,
Stefek
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file upload and file attach to email
«
Reply #13 on:
September 04, 2008, 05:02:15 PM »
Quote from: erpe on September 04, 2008, 04:27:43 PM
Works now.
Set path in options like: /media/name/file
(path file created in media) and form loads up your file as (for example):
file04092008040935-yourfile.txt
Works now!
Thank you guys for helping.
(pretty stupid: all the time I considered that i have to put the whole path to my folder instead of just the
/media/blabla/file
)
Is there any way how I can limitate the filetype for only JPG / JPEG / BMP / PNG / GIF ?
Thanks for any suggestion.
Best Regards,
Stefek
«
Last Edit: September 04, 2008, 05:20:32 PM by Stefek
»
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
erpe
Offline
Posts: 1738
Re: FormX - Forms with file upload and file attach to email
«
Reply #14 on:
September 04, 2008, 05:13:09 PM »
Does it make sense to have files like
file04092008040935-yourfile.txt
in your media directory?
What is the reason for renaming a file "yourfile.txt" in "file04092008040935-yourfile.txt" by uploading it ?
Any suggestions?
rgds
erpe
Logged
Search on
All Modules And Snippets Project (AMASP)
Be part of the
Tutorials-Project
sharmpro
Offline
Posts: 64
Re: FormX - Forms with file upload and file attach to email
«
Reply #15 on:
September 04, 2008, 05:21:59 PM »
Hi there,
i have already limited the file .ext (for graphics only) into my mods locally,
i even use PEAR Upload package in order to ensure portability/compatibility and security
but honestly this bit & pieces type of work will not bring substantial benefit to WB...
There're more than a couple of mod based on Form aot there, with several new feature but
living a stand-alone life..
Is there a way someone picks up the module and work it out as a complete project?
Getting suggestions, bugs & feedback from the community and implement these into the mod....
BTW I rename the file w/timestamp in order to 'hide' it from the user.... even if he upload a 'worm.php' program
he'll not be able to link it directly... and execute...
Regards
Stefano
Logged
SharmPRO
http://www.sharmpro.com
http://www.jcwebden.com
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file upload and file attach to email
«
Reply #16 on:
September 04, 2008, 05:29:52 PM »
Quote from: sharmpro on September 04, 2008, 05:21:59 PM
Hi there,
i have already limited the file .ext (for graphics only) into my mods locally
Hallo Stefano!
I would appreciate if you let me know how to do this.
Regards,
Stefek
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
erpe
Offline
Posts: 1738
Re: FormX - Forms with file upload and file attach to email
«
Reply #17 on:
September 04, 2008, 10:30:08 PM »
Quote
BTW I rename the file w/timestamp in order to 'hide' it from the user.... even if he upload a 'worm.php' program
he'll not be able to link it directly... and execute...
That makes sense.............
rgds
erpe
Logged
Search on
All Modules And Snippets Project (AMASP)
Be part of the
Tutorials-Project
ecology
Offline
Posts: 59
Re: FormX - Forms with file upload and file attach to email
«
Reply #18 on:
September 09, 2008, 08:02:43 PM »
hi together
first of all i have to thank to this great module!
the only thing what i had to change is, when i get the mail from the contact i would like to see the name of this person in the email-adress... like -> Hans Muster (
hans.muster@mail.com
)
in the settings you can fill in a name by hand but then every mail-address has the same name.
so i had to change the code of this a bit and now i can choose the fild witch is the name of the sender.
if you like you can add this code too as follow:
1.)
modify_settings.php
search for:
Code:
<tr>
<td class="setting_name">
<?php
echo
$TEXT
[
'EMAIL'
].
' '
.
$TEXT
[
'NAME'
];
?>
:</td>
<td class="setting_name">
<input type="text" name="email_fromname" style="width: 98%;" maxlength="255" value="
<?php
echo
str_replace
(
$raw
,
$friendly
, (
$setting
[
'email_fromname'
]));
?>
" />
</td>
</tr>
replace with:
Code:
<tr>
<td class="setting_name" width="30%">
<?php
echo
$TEXT
[
'EMAIL'
].
' '
.
$TEXT
[
'NAME'
];
?>
:</td>
<td class="setting_name">
<select name="email_fromname" style="width: 98%;">
<option value="" onclick="javascript: document.getElementById('email_fromname').style.display = 'block';">
<?php
echo
$TEXT
[
'NONE'
];
?>
</option>
<?php
$email_fromname
=
str_replace
(
$raw
,
$friendly
, (
$setting
[
'email_fromname'
]));
$query_email_fields
=
$database
->
query
(
"SELECT field_id,title FROM "
.
TABLE_PREFIX
.
"mod_formx_fields WHERE section_id = '$section_id' AND ( type = 'textfield' OR type = 'email' ) ORDER BY position ASC"
);
if(
$query_email_fields
->
numRows
() >
0
) {
while(
$field
=
$query_email_fields
->
fetchRow
()) {
?>
<option value="field
<?php
echo
$field
[
'field_id'
];
?>
"
<?php
if(
$email_fromname
==
'field'
.
$field
[
'field_id'
]) { echo
' selected'
;
$selected
=
true
; }
?>
onclick="javascript: document.getElementById('email_from').style.display = 'none';">
<?php
echo
$TEXT
[
'FIELD'
].
': '
.
$field
[
'title'
];
?>
</option>
<?php
}
}
?>
</select>
</td>
</tr>
--------------------------------------
2.)
view.php
search for:
Code:
$email_fromname = $fetch_settings['email_fromname'];
replace with:
Code:
$email_fromname = $fetch_settings['email_fromname'];
if(substr($email_fromname, 0, 5) == 'field') {
// Set the email from field to what the user entered in the specified field
$email_fromname = htmlspecialchars($wbx->add_slashes($_POST[$email_fromname]));
}
That's all...
hope you'll like it
cya ecology
so,... first code had a bug... but this is "clean" now...
«
Last Edit: September 09, 2008, 09:44:11 PM by ecology
»
Logged
echo "hello world" ;-?
sharmpro
Offline
Posts: 64
Re: FormX - Forms with file upload and file attach to email
«
Reply #19 on:
September 09, 2008, 08:58:12 PM »
Hi Ecology,
thank you for the useful add-on.
I'll upgrade the module to version 1.1.d with your code and with the possibility to restrict the type of file will be possible to upload that was requested on a previous post.
Regards
Stefano
Logged
SharmPRO
http://www.sharmpro.com
http://www.jcwebden.com
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file upload and file attach to email
«
Reply #20 on:
September 09, 2008, 11:12:27 PM »
That's a geat addition in fact.
I have another idea what would be helpfull and could be implemented (easy I think) into the module.
If I look into the list of recieped mails inside the backend I can choose one of them.
Than the whole massage and the uploaded file path can be seen.
I would like it more, if we have a link instead of the path.
Do you understand what I'm thinking of, Stefano?
Regars,
Stefek
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
sharmpro
Offline
Posts: 64
Re: FormX - Forms with file upload and file attach to email
«
Reply #21 on:
September 10, 2008, 02:25:28 AM »
Hi,
Already done in module 1.1.d...
Stefano
Logged
SharmPRO
http://www.sharmpro.com
http://www.jcwebden.com
bb_team
Offline
Posts: 5
Re: FormX - Forms with file captcha/upload/calendar/mail attachment/submission
«
Reply #22 on:
September 12, 2008, 02:05:48 PM »
hello, thank you fo uploadingr 1.2
i was frustrated with the default form module and this one makes things much easier.
just a question, though:
wouldn't it be smart to insert the form data in the database not as a simple text but as a serialized array?
it would then be easier to analyze and use the collected data, both in wb (result table could be ordered by field) and by generating a hypotetical csv file which would be importable in spreadsheet programs.
Logged
Stefek
Backend Theme Team
Offline
Posts: 3202
Re: FormX - Forms with file captcha/upload/calendar/mail attachment/submission
«
Reply #23 on:
September 12, 2008, 02:16:17 PM »
Hallo Stefano.
I had just one single Problem:
if you set "UPLOAD FILE" as required you can not send the form.
Can anyone agree with this?
Stefek
Logged
Bowling in
Kiel
Halle
Aschaffenburg
"Es gibt viele Pfade am Fuße des Berges,
doch von der Spitze aus, erblicken wir alle den selben Mond."
jap. Sprichwort
sharmpro
Offline
Posts: 64
Re: FormX - Forms with file captcha/upload/calendar/mail attachment/submission
«
Reply #24 on:
September 12, 2008, 03:58:12 PM »
Hi,
bb-team had a nice idea... save the sumbmitted data into a serialized array... Will be implemented soon
File Upload required..... is still not 100% implemented... It'll be also soon in the next release.
Thank you for your feedbak.
Regards,
Stefano
Logged
SharmPRO
http://www.sharmpro.com
http://www.jcwebden.com
Pages:
[
1
]
2
3
...
8
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
Loading...