File Upload Problem

Home Forums Quform WordPress File Upload Problem

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4611
    lawrencepepper
    Participant

    Hello,

    I have an update form setup which has a file upload field in it. When the form is submitted I have the values sent to a script which updates the row in a database.

    In my functions file I have:

    function updatepart_post_to_another_script($form)
    {
    // Rewrite the post variables
    $post = array(
    'description' => $_POST['iphorm_9_4'],
    'detailed' => $_POST['iphorm_9_5'],
    'notes' => $_POST['iphorm_9_17'],
    'rnumber' => $_POST['iphorm_9_23'],
    'manufacturer' => $_POST['iphorm_9_8'],
    'mnumber' => $_POST['iphorm_9_9'],
    'altmanufacturer' => $_POST['iphorm_9_10'],
    'altnumber' => $_POST['iphorm_9_11'],
    'file' => $_POST['iphorm_9_14'],
    'fdescription' => $_POST['iphorm_9_18'],

    );

    // Create a new cURL resource
    $ch = curl_init();

    // Set URL and other appropriate options
    curl_setopt($ch, CURLOPT_URL, 'http://www.mysite.com/scripts/update_part.php');
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));

    // Grab URL and pass it to the browser
    curl_exec($ch);

    // Close cURL resource, and free up system resources
    curl_close($ch);
    }
    add_action('iphorm_post_process_9', 'updatepart_post_to_another_script', 10, 1);

    The script that updates the database is:


    <?php

    // Do Update

    $con = mysql_connect("localhost","xxx","xxx");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("edata", $con);

    mysql_query("UPDATE part_record SET description='$_POST[description]', detailed_description='$_POST[detailed]', notes='$_POST[notes]', manufacturer='$_POST[manufacturer]', manufacturer_number='$_POST[mnumber]', alt_manufacturer='$_POST[altmanufacturer]', alt_number='$_POST[altnumber]', file='$_POST[file]', file_description='$_POST[fdescription]'
    WHERE record_number='$_POST[rnumber]'");

    mysql_close($con);

    ?>

    All fields get updated but the File field. If someone picks a file to upload the file gets uploaded, the file description gets updated but nothing get’s updated/inserted into the file field. I need the file name to be inserted into the file field. Any ideas?

    Thanks

    L

    #4628
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #4699
    lawrencepepper
    Participant

    Thanks.

    Worked!

    L

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy