Closed travisbotello closed 5 years ago
Sorry about that....I can't reproduce this when using regular form submission. This is only causing issues when using ajax form processing. Seems like the error is caused by my ajax setup.
However when enabling ajaxuploadAllowOverwrite
I am seeing the same php execution time out error:
[[!FormIt?
&hooks=`AjaxUpload2Formit`
&ajaxuploadFieldname=`image`
&ajaxuploadTarget=`image-cache/uploads`
&ajaxuploadUid=`image`
&ajaxuploadAllowOverwrite=`1`
]]
<form method="post" action=[[~[[*id]]]]>
[[!AjaxUpload?
&uid=`image`
&allowedExtensions=`jpg,jpeg,png,gif`
&thumbX=`75`
&thumbY=`75`
]]
<input type="submit" value="abschicken">
</form>
Additionally it can be reproduced setting ajaxuploadClearQueue
to true:
[[!FormIt?
&hooks=`AjaxUpload2Formit`
&ajaxuploadFieldname=`image`
&ajaxuploadTarget=`image-cache/uploads`
&ajaxuploadUid=`image`
&ajaxuploadClearQueue=`1`
]]
<form method="post" action=[[~[[*id]]]]>
[[!AjaxUpload?
&uid=`image`
&allowedExtensions=`jpg,jpeg,png,gif`
&thumbX=`75`
&thumbY=`75`
]]
<input type="submit" value="abschicken">
</form>
What kind of ajax solution do you use?
In frontend I am using vue.js with axios and then processing server-side via MODx resource with an empty template and a formit snippet call. Working quiet well. But as I said I was able to reproduce the issue with a non-ajax form submission. Either setting &ajaxuploadClearQueue
to true or setting ajaxuploadAllowOverwrite
to true is causing the php timeout error...looks like there is a problem.
Steps to reproduce:
(1) Place this code in your template
[[!FormIt?
&hooks=`AjaxUpload2Formit`
&ajaxuploadFieldname=`image`
&ajaxuploadTarget=`image-cache/uploads`
&ajaxuploadUid=`image`
&ajaxuploadClearQueue=`1`
]]
<form method="post" action=[[~[[*id]]]]>
[[!AjaxUpload?
&uid=`image`
&allowedExtensions=`jpg,jpeg,png,gif`
&thumbX=`75`
&thumbY=`75`
]]
<input type="submit" value="abschicken">
</form>
(2) Upload a file (3) Submit form (4) File will be placed in correct folder (5) Reload page upload same file again => Getting php timeout error.
Trace:
2019/03/21 09:23:40 [error] 5234#5234: *67773 FastCGI sent in stderr: "PHP message: PHP Fatal error: Maximum execution time of 30 seconds exceeded in /www/core/components/ajaxupload/model/ajaxupload/ajaxupload.class.php on line 366" while reading response header from upstream, client: 127.0.01, server: test.local, request: "POST /test.html HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "test.local", referrer: "https://test.local/test.html"
Please create the AjaxUpload call before the FormIt call. If I am right, this should solve the issue.
I tried that and changed the order, but it is still not working.
Any update on this, it looks like we are getting the same error reported.
I take that back, I actually had to add the setting &ajaxuploadAllowOverwrite=`1`
in order for the uploads to stop timing out.
I tried adding &ajaxuploadAllowOverwrite=1
but it did not seem to fix our issue. This issue occurs when uploading a file for the third time regardless if this setting is turned on or not, and may only occur with slower internet connections. In the mean time I am going to try rolling back to a previous version. Thanks.
I bypassed the issue by adding an additional formit hook that renames/moves the file to a different location after uploading.
This should be fixed with the 1.5.7 release.
When a file with the same name exists in the upload folder AjaxUpload appends a
_1
to the uploaded file whenajaxuploadAllowOverwrite
is set tofalse
. For example:Upload download.jpg
Upload download.jpg again
When
download.jpg
is uploaded a third time this results in an error and the php script times out.