Allowed extensions for File Uploads not working

Blade 18 Dec, 2007
Hi!

I'm trying to build a form with two file uploads, one field for .doc and .pdf, the other for a photo. However, my files don't get accepted and never make it to the server.

I put in "CV:doc|pdf,foto:jpg|gif|png" under File Uploads => Allowed Extensions and saved the form. However, when I go back to Edit the form again, Allowed Extensions now has the value "Arrray".

I'm using Joomla 1.5 RC3 and the latest ChronoForms.

I already set the PHP error reporting level to E_NOTICE so this isn't due to the bug where php warnings are generated due to some vars not being initialised before use.

Any help is appreciated
GreyHead 18 Dec, 2007
Hi Blade,

That's weird, I don't recognise that problem at all. Please will you take a backup copy of the form (use the button in Forms Manager) and post it here or email it to me at the address in my sig.

Bob
Max_admin 19 Dec, 2007
Hi Blade,

Have you made any hacks to ChronoForms ? there is a bug with the 1.5 version in the file uploads section and yes files will never get uploaded without a hack, please search the forums for it, its here somewhere🙂

Sincerely,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 19 Dec, 2007
Hi Blade & Max,

I've updated the 1.5 download version to RC1a which now includes this bugfix. I've also attached the amended chronocontact.php to this post.

Bob [file name=chronocontact-ffc23672acca804e7618e1c737eecd83.zip size=5028]http://www.chronoengine.com/components/com_fireboard/uploaded/files/chronocontact-ffc23672acca804e7618e1c737eecd83.zip[/file]<br><br>Post edited by: GreyHead, at: 2007/12/19 15:37
Max_admin 19 Dec, 2007
Great, Thank you very much Bob!!🙂

Sincerely,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gg4j 27 Dec, 2007
Ouch!


So I tryed the file, but no working.

I must say that CC under JRC1 works fine.

I wanna upgrade to RC4.

I copyed the same form running under RC1.
Upload no working.

I tryed to copy the chronocontacts.php from the one working RC1 to RC4, no results.

I tryed with your amended file as well, no uploading.
And neither the name of the file in the record....
ARSH!

Any help^!?!:sick:
GreyHead 27 Dec, 2007
Hi gg4j,

Sorry, I haven't even downloaded RC4 yet so have no idea what might have changed. I expect that Max will make a new release in the next week or so.

Bob
Max_admin 28 Dec, 2007
Hi gg4j, as suggested at the other thread, please check paths permissions ?

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 30 Dec, 2007
Hi Max,

From some work done by Blade there seems to have been a change in the behaviour of $registry->toObject() in RC3. It seems that it is exploding the piped string e.g. 'foto:jpg|gif|png' into separate array entries like [0]=>foto:jpg, [1]=>gif , [2]=>png

It looks like some re-coding is needed to work round the change.

Bob
gg4j 30 Dec, 2007
Upload dir checked and set 777

still same problem with "array", as showned in the attached gif.

I think the problem should be there.

Thanks a lot for a help, Max & Bob!

I look forward your reply.:cheer:
GreyHead 30 Dec, 2007
Hi Max and gg4j,

I think I have a fix for this. The problem seems to be that in some cases (maybe all) the registry string 'uploadfields' is being exploded into an array on the pipe character '|' (see my previous post).

Two code changes are needed to fix this. In chronocontact.php around line 233 replace
$allowed_s1 = explode(",", trim($paramsvalues->uploadfields));
with
if ( is_array($paramsvalues->uploadfields) ) {
  $allowed_s1 = implode('|', $paramsvalues->uploadfields);
} else {
  $allowed_s1 = $paramsvalues->uploadfields;
}
$allowed_s1 = explode(",", trim($allowed_s1));
and in admin.chronocontact.html.php around line 91 replace
$paramsvalues = $registry->toObject( );
with
$paramsvalues = $registry->toObject( );
if ( is_array($paramsvalues->uploadfields) ) {
  $paramsvalues->uploadfields = implode('|', $paramsvalues->uploadfields);
}
and I think that file uploads should work OK.

Bob
Max_admin 01 Jan, 2008
Thank you very much Bob, I will test this with RC4 and hopefully get the new release ASAP!🙂

Happy New Year for you and for Everybody!

Sincerely,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Blade 08 Jan, 2008
Thanks for all the help guys, this solved all my upload problems, including in RC4.

Have a Bug-free New Year!
BandcaveMan 17 Jan, 2008
Not sure how this relates to this thread, but I just learned something worth sharing. I set up a form for file uploads and when submitting the file via the form, an error msg said "Sorry, your uploaded file type is not allowed"

I had included this line in the file uploads tab "datafile:jpg"

What I then realized is that it must be CASE sensitive. I changed it to "datafile:jpg|JPG" and it now works. Most of my jpegs from my camara are stored in upper case when I transfer them to my computer or browse to the camera for the file.

I was trying to upload files like xxx.JPG and it did not work, now it does.

I would recommend a code change converting this to lowercase prior to acting upon it.

Anyway, hope this helps someone who may be stuck...

BandcaveMan
GreyHead 17 Jan, 2008
Hi bandcaveman,

That's a known bug, it's fixed in 2.3.7 for Joomla 1.0.x and I'm sure Max has it fixed for the next release for Joomla 1.5 too. To fix for Joomla 1.0.x please upgrade to the current 2.3.7; for Joomla 1.5 make these changes in chronocontact.php

a) at about line 240 replace
$allowed_s3      = explode("|", trim($allowed_s2[1]));
with
 $allowed_s3      = explode("|", strtolower(trim($allowed_s2[1])));
and at about line 257 replace
if ( !in_array($fext, $allowed_s3) )
with
if ( !in_array(strtolower($fext), $allowed_s3) ) {
I think those are the only changes.

Bob
gg4j 19 Jan, 2008
Yeah thank you seriously guys, and sorry for no long reply!
:D
:D

Everything is fine now!
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger