Forums

error file max size

creositi 23 Aug, 2014
Hello,
I have a file upload form. I set the max-size 2560kb (2.5MB). If you load the file slightly larger than, for example a file of 3000kb, I get the error chronoform.
If I try to upload much larger files, for example of 11000000kb, the file is loaded without error.
I read this old thread
http://www.chronoengine.com/forums/posts/f3/t88923.html?page=1
and I saw that in the php.ini of my server, upload_max_filesize is set to 10mb.
How I change this value? I mean, what should I write instead of 10mb?
I have to put upload_max_filesize 2.5MB?
Max_admin 23 Aug, 2014
Hi creositi,

The very big file gets uploaded ? are you sure ? can you find it with the same size on your server ?

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
creositi 23 Aug, 2014
No, sorry, I explained badly.
I do not know if you remember me, we had felt by mail a week ago (I'm Italian) to the upload form, after uploading to file you will be redirected to paypal, thanks to paypal IPN, the file is moved to a other folder.

The file is not loaded (in the sense that it is not saved), but the form redirects to paypal and does not come out the error of chronoform. The user pays and think that the file is loaded.

PS I've also sent an email a couple of hour ago for a small problem always relative to this forum .... we have added that the form sends an e-mail if paypal confirm payment. I entered the user data in this mail (e-mail address and username) but I think it conflicts with the redirect to paypal. Because if I remove the redirect to Paypal, the mail arrives with the user's data. If I leave the redirect to paypal, the mail arrives without the user's data ...
Sorry if I added another problem:-(
Max_admin 23 Aug, 2014
I remember you, I will reply to your email shortly!🙂

But regarding the question here, I think PHP just ignores the file because its very large, you may also check with your host admin if there is a PHP setting to make PHP returns an error, but it looks like there is not, check the answer here:
http://stackoverflow.com/questions/615312/no-error-when-uploading-a-really-big-file-in-php

So the best solution in this case is to use "Custom server side validation" to check that the file is not empty:

<?php
if(empty($form->files["file_field_name"])){
$form->validation_erros[] = "File upload failed".
return false;
}

And then use an "Event loop" in the "on fail" event of the "custom validation" action.

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
creositi 23 Aug, 2014
Perfect, this works .... thanks a lot.
The file is not loaded, but I get this error:

Parse error: syntax error, unexpected 'return' (T_RETURN) in /home/..../public_html/administrator/components/com_chronoforms/form_actions/custom_serverside_validation/custom_serverside_validation.php(19) : eval()'d code on line 4

You can change the phrase error? In such a way that the phrase is: FILE IS TOO BIG ...
GreyHead 24 Aug, 2014
Hi Creositi,

I'm not sure why you aren't seeing an error when a very big file is uploaded; that might be a ChronoForms bug :-(

You can usually change the max-filesize setting in your php.ini file - check with your webhost to see how they have this set up.

Bob
Max_admin 24 Aug, 2014
My code has a bug, sorry, please change this line:
$form->validation_erros[] = "File upload failed".

to:
$form->validation_erros[] = "File upload failed";


Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Jamesbond07 04 Mar, 2015
1 Likes
Hi there,

First of all thank you for your continuous support, I have been using Chronoforms for quite a while and found many solutions to problems I encountered along the way on this forum.

Reading this post, I noticed a small typo error to the second segment of code:

to:
$form->validation_errors[] = "File upload failed";


Best regards
Max_admin 04 Mar, 2015
Thank you!🙂
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.