Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file_get_contents error for upload fields #1674

Open
green17 opened this issue Dec 9, 2024 · 2 comments
Open

file_get_contents error for upload fields #1674

green17 opened this issue Dec 9, 2024 · 2 comments
Assignees
Labels
issue Something isn't working correctly

Comments

@green17
Copy link

green17 commented Dec 9, 2024

What happened?

We recently upgraded from Freeform 3 to 4, along with upgrading Craft CMS from version 3 to 4. Our setup includes several file systems configured without public URLs for security reasons. When using the upload field with a standard, publicly accessible file system, everything functions as expected. However, when we use a file system without a public URL, the form fails to submit and generates an error - file_get_contents(test/file.pdf): Failed to open stream: No such file or directory.

Although the file is successfully uploaded to the correct location, the form will not submit.

Errors and Stack Trace (if available)

No response

How can we reproduce this?

  1. In Craft's filesystem settings, toggle the "Files in this filesystem have public URLs" to off for a filesystem.
  2. In the form builder, choose this filesystem as the asset source for a file upload field.
  3. When the form has loaded on the front end, choose a file to upload and submit the form.

Freeform Edition

Pro

Freeform Version

4.1.23

Craft Version

Craft Pro 4.13.5

When did this issue start?

After upgrading from older Freeform version

Previous Freeform Version

3.x

@green17 green17 added the issue Something isn't working correctly label Dec 9, 2024
@kjmartens
Copy link
Contributor

Sorry for the trouble and the delay, @green17.

I tested this on my end and I can't seem to duplicate the issue. I'm curious, are you 100% sure the path is correct for the Asset/Filesystem? And how is your email notification template configured? 🙂

@kjmartens kjmartens self-assigned this Dec 19, 2024
@green17
Copy link
Author

green17 commented Dec 20, 2024

Hi @kjmartens, the file system looks to be set up correctly as the file does upload in the background, however it does fail validation and will not submit (this happens when the field is set to required and when not). As this folder sits outside of the web folder, I have a path set up in DDEV (e.g. in the SNV file I have this variable: UPLOADS_PATH = /var/www/html/locked).

When I tested it with a folder inside the web/assets directory, it also failed to submit though the file was uploaded to the correct location. The error was: deleteFile() is not implemented.

The email notification template is very basic, it really only loops through the submission fields. I have tried this without the notification and also without any other fields except for the file upload field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

No branches or pull requests

2 participants