This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Pull file name from "File Upload" field


  1. melanieivy
    Member

    Hi, I'm trying to get the file name value from the file uploaded through the single file upload button as a value to send to our CRM. I am just trying to send the value so we have it for our records... not the file.

    I see the value in the SQL database in the "element_13" field but when I pull $table_data['element_13'] in post-functions.php it is empty.

    Anyone know how I can pull this?

    Posted 12 years ago #
  2. yuniar

    Accessing the file is different compared to other fiels.

    You need to use $_FILES[$element_name]['name']

    or in your case:

    $_FILES['element_13']['name']

    MachForm Founder

    Posted 12 years ago #
  3. melanieivy
    Member

    Thank you so much for the response... this is a help with sending over the file name info to show that we received it. Is there any way to send the full name of the file that writes to our directory? I'd like to reconstruct the URL as a value. I've been playing with it for a while now and I just can't find a way to pass that full file name or URL value. It would be such a huge help with the workflow of our organization!

    Posted 12 years ago #
  4. yuniar

    Getting the complete filename is a bit complex indeed. It depends on many conditions.
    If I may suggest, it might be easier to get the filename by doing a query into your form's table.

    So, at the end of "mf_process_form()" function, do a simple query to your "ap_form_X" table and get the specific column that stored the complete file name.


    MachForm Founder

    Posted 11 years ago #
  5. melanieivy
    Member

    OK that makes sense, and I was wondering if that could be done since I did see the full file name is stored in the DB. I was wondering if I could run a query and assign the value to a variable, so this would be perfect.

    I can read SQL, but I haven't written a query this through PHP before... do you have an example of a query that does something similar? If I see an example I could definitely modify it to pull the table & column needed. I ran a search for SQL and didn't see any posts on what I'm looking for, but if there is one out there that I missed I will be happy to pull it from that.

    Thank you for the valuable support... integrating our forms with SF CRM has already made such an impact on the amount of admin work required to process applications for our foundation. This will just be the icing on the cake, removing a couple of extra steps out of our workflow/communication process and making it even easier on our families & volunteers!

    Posted 11 years ago #
  6. yuniar

    There are many queries within that file. Here is a simple one you can use:

    http://pastie.org/private/xiokl3sc0pc7ny69rjpoxq

    on the above sample, the column name of the file field is "element_2" and your form id number is 3


    MachForm Founder

    Posted 11 years ago #
  7. melanieivy
    Member

    This works perfect :) Thanks so much for your assistance!

    Posted 11 years ago #

RSS feed for this topic

Reply