[solved] AjaxUpload V2 Error: File size not available

Hello, since upgrading to V2, I have been experiencing issues with uploading files.

PHP 8.4.14 (upload_max_filesize: 8 M) + MODX 3.12-pl + FormIt 5.1.1-pl + AjaxUpload 2.0.4-pl

My test file is 422 KB in size. Could my configuration be incorrect?
Does anyone have a solution or tip for this?

I see that in the HTML source (sorry, the original is in German and I’m trying to translate it):

<script>
    FilePond.registerPlugin(
        FilePondPluginFileValidateType,
        FilePondPluginFileValidateSize,
        FilePondPluginImagePreview
    );
    FilePond.create(document.querySelector('#filepond-attachWeb'), {
        name: 'attachWeb[]',
        server: {
            url: '/assets/components/ajaxupload/connector.php',
            process: '?uid=attachWeb&action=process',
            patch: '?uid=attachWeb&action=patch',
            revert: '?uid=attachWeb&action=revert',
            fetch: '?uid=attachWeb&action=fetch',
            restore: '?uid=attachWeb&action=restore&id=',
            load: '?uid=attachWeb&action=load',
        },
        chunkUploads: true,
        credits: [],
        acceptedFileTypes: ["image/jpeg","image/gif","image/png","image/webp","application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
        maxFiles: "4",
        maxFileSize: "8MB",
        files: [],
        labelIdle: 'Drop files or <span class="filepond--label-action"> select </span>',
        labelInvalidField: 'Field contains invalid files',
        labelFileWaitingForSize: 'Calculating file size',
        labelFileSizeNotAvailable: 'File size not available',
        labelFileLoading: 'Loading',
        labelFileLoadError: 'Error while loading',
        labelFileProcessing: 'Upload in progress',
        labelFileProcessingComplete: 'Upload complete',
        labelFileProcessingAborted: 'Upload aborted',
        labelFileProcessingError: 'Error during upload',
        labelFileProcessingRevertError: 'Error while restoring',
        labelFileRemoveError: 'Error while deleting',
        labelTapToCancel: 'cancel',
        labelTapToRetry: 'retry',
        labelTapToUndo: 'undo',
        labelButtonRemoveItem: 'Remove',
        labelButtonAbortItemLoad: 'Discard',
        labelButtonRetryItemLoad: 'Retry',
        labelButtonAbortItemProcessing: 'Cancel',
        labelButtonUndoItemProcessing: 'Undo',
        labelButtonRetryItemProcessing: 'Retry',
        labelButtonProcessItem: 'Upload',
        labelMaxFileSizeExceeded: 'File is too large',
        labelMaxFileSize: 'Maximum file size: {filesize}',
        labelMaxTotalFileSizeExceeded: 'Maximum total file size exceeded',
        labelMaxTotalFileSize: 'Maximum total file size: {filesize}',
        labelFileTypeNotAllowed: 'Invalid file type',
        fileValidateTypeLabelExpectedTypes: 'Expected {allButLastType} or {lastType}',
        imageValidateSizeLabelFormatError: 'Image type not supported',
        imageValidateSizeLabelImageSizeTooSmall: 'Image is too small',
        imageValidateSizeLabelImageSizeTooBig: 'Image is too large',
        imageValidateSizeLabelExpectedMinSize: 'Minimum size: {minWidth} × {minHeight}',
        imageValidateSizeLabelExpectedMaxSize: 'Maximum size: {maxWidth} × {maxHeight}',
        imageValidateSizeLabelImageResolutionTooLow: 'Resolution is too low',
        imageValidateSizeLabelImageResolutionTooHigh: 'Resolution is too high',
        imageValidateSizeLabelExpectedMinResolution: 'Minimum resolution: {minResolution}',
        imageValidateSizeLabelExpectedMaxResolution: 'Maximum resolution: {maxResolution}'
    });
</script>

Here are the relevant snippet:

[[!FormIt?
  &preHooks=`Formit2AjaxUpload`
  &hooks=`spam,math,userAgent,FormItSaveForm,AjaxUpload2Formit,AjaxUploadAttachments,email,AjaxUploadRemove,redirect`
  &formName=`pmsKontakt`
  &formFields=`email,firstname,name,typ,mailAn,row1,row2,row3`
  &fieldNames=`row1==REMOTE_ADDR,row2==REMOTE_HOST,row3==HTTP_USER_AGENT`
  &ajaxuploadTarget=`uploads/`
  &ajaxuploadUid=`attachWeb`
  &emailTpl=`pmsEmailChunk`
  &emailTo=`[[+mailAn]]`
  &emailSubject=`Gesendet vom Kontaktformular [[++site_name]]`
  &redirectTo=`19`
  &mathMinRange=`1`
  &mathMaxRange=`12`
  &validate=`math:required,
  firstname:required:maxLength=50,
  name:required:maxLength=50,
  email:email:required:maxLength=60,
  text:required:stripTags:maxLength=2000,
  typ:required,
  mailAn:required,
  datenschutz:required,
  name2:blank`
]]


  [[!AjaxUpload?
    &addCss=`1`
    &uid=`attachWeb`
    &acceptedFileTypes=`image/jpeg,image/gif,image/png,image/webp,application/pdf,text/plain,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document`
    &maxFileSize=`8MB`
    &maxFiles=`4`
    &showCredits=`0`
  ]]

Thank you
Jo (Bitburg - Germany)

When exactly do you get the “Size not available” (“Dateigröße nicht verfügbar”) error?
When you Drag & Drop a file into the form field, or when you send the form?
Does the error occur for all files or only for certain types?


When you open the developer tools in the browser and go to the “Network” tab and then upload a file, is there a request to assets/components/ajaxupload/connector.php?... that fails?

Are there related errors that get added to the MODX error log when you try to upload a file?

Thanks for the tips!

When exactly does the ‘File size not available’ error occur?
→ When I drag and drop a file into the form field
→ I have tested several file types
→ The MODX error log is empty

Link to my test page: Kontakt - Malbergweich

If you open the developer tools in your browser, go to the ‘Network’ tab and then upload a file, is there a request to assets/components/ajaxupload/connector.php?.. that fails?
→ I will check this later and report back.

I only see a generic “Fehler beim Upload” message when I test it.


Testing it locally, I was able to get rid of this error message, when I used only lowercase characters for the uid:

[[!FormIt?
	...
	&ajaxuploadUid=`attachweb`
	...
]]

[[!AjaxUpload?
	&uid=`attachweb`
	...
]]

Awesome! thats the solution. a huge thank you to you!
A really big thank you - really!

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.