How to create a form to upload a file and to feed the database? (6 posts)

  1. Orel
    Posted 5 years ago #


    On a page of my blog, I would like my visitors to be able to send me a file with its name and description (via a form)

    When done, I would like my database to have the information about this file (location of the file on my server, name filled and description filled)

    Is there any plug-in doing that? (I didn't find any for now)

    Thank you in advance for your help!

  2. jonradio
    Posted 5 years ago #

    Personally, I found cforms ii to be the most comprehensive Forms plug-in available. Although I haven't used the File Upload feature, it does exist. From the Features page:

    File attachments / Upload, fully configurable per form

    Here is the direct link, as the plug-in directory entry is out of date:

    I should also mention that I was trying to do something not listed in the cforms ii features list, but found it really straight forward to write my own php code to get the job done, thanks to all the built-in functionality cforms provided to my php code.

  3. Orel
    Posted 5 years ago #

    Thanks adiant for your answer,

    I tried cformsII which is a good one but it is unfortunately not feeding the database

  4. jonradio
    Posted 5 years ago #

    As I tried to intimate, cforms ii doesn't do everything one could ever imagine "out of the box". You will have to add your own php code to do these extra things.

    Note the description of the API (Application Programming Interface):

    Do you require more flexibility in your forms? Then create and deploy forms at run-time. Mind you, to use this feature it requires basic and possibly more advanced PHP knowledge, examples you’ll find in the HELP! section of plugin admin pages.

    This will essentially allow you to pull data from an external source and feed it into your ad-hoc created form fields. I’ve deliberately not included any sort of external data administration, as everyone will have a different file or database table syntax. Any of the fields described in the HELP! section can be created at run-time and shown online. Minor drawback: this works only in non-Ajax mode.

    Post processing of user input
    cforms comes with several adjustable functions (and examples) that allow you to filter and modify user input on the fly as well as trigger an action after user input has been accepted, you can even change cforms settings during run-time, such as page redirection & admin email. All great capabilities to incorporate your own application and business logic!

  5. Orel
    Posted 5 years ago #

    All right, thanks anyway. I was just hoping this kind of plug in was existing!

  6. jonradio
    Posted 5 years ago #

    It kind of begs the question as to whether some of the larger Plug-ins will some day have Plug-ins of their own.

Topic Closed

This topic has been closed to new replies.

About this Topic