Support » Plugin: HTML Forms » Hook or filter for file uploads/attachments?

  • Resolved sten360

    (@sten360)


    Hi! First off I just want to say I’m a huge fan of the plugin, so thank you!

    I recently purchased the premium version for a site that needed file uploads, and I am having a bit of trouble adding a small custom feature to it. Since users upload a lot of files on this site and they all get automatically added to the media library, it clogs up the media library and media uploader. On this site, there iss actually no use for seeing these files in the library at all, as the purpose of the form is just to upload them onto a separate custom directory on the site and then e-mail direct links to the admin. It would be great if we could disable attachment generation altogether, but it seemed not to be possible.

    My idea to remedy this was to create media categories and automatically assign the files uploaded from the user form to a specific category, so that they could be filtered out. I’ve got everything covered except I can’t find a way to target the files that are uploaded via HTML Forms specifically. Is there any action or filter I could hook my logic onto after the file has been uploaded and the attachment object generated? Or perhaps there’s some other solution I haven’t even thought about?

    And a small secondary question; is there a cap on the number or size of uploaded files? Due to a form having a large number of fields, I’ve noticed that the uploads get cut off after a certain point. I’m unsure whether that’s because of the files and their individual sizes adding up and perhaps going over the upload_max_size or post_max_size limit, or if there’s some cap on how many fields you can have and send at once? I realize having this many fields is a bad practice to begin with and should probably be remedied in other ways, but for now I would just like to get an idea of what’s going on.

    Thank you for your time.

    • This topic was modified 2 months ago by sten360.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Lap

    (@lapzor)

    Please look at the code snippets here: https://github.com/ibericode/html-forms-code-snippets
    Especially snippets starting with file-upload-…

    Any cap would be set in your PHP configuration (of by your hosting provider) such as Max Postsize and Max Upload size.

    Hope that helps. If you have any questions, please let me know!

    Thread Starter sten360

    (@sten360)

    Oh! I’m not sure how I overlooked these… Well this made things a lot simpler, I was able to solve my problem with the disable media & direct links snippets. Thank you!

    Plugin Contributor Lap

    (@lapzor)

    Maybe you overlooked them because they are just very recently added to the latest plugin update 😉

    Glad to hear that worked out for you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.