Make WordPress Core

Changeset 3360


Ignore:
Timestamp:
12/26/2005 09:55:24 AM (17 years ago)
Author:
ryan
Message:

Use wp_handle_upload().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/link-import.php

    r3295 r3360  
    8383                else // try to get the upload file.
    8484                {
    85                     $uploaddir = get_settings('fileupload_realpath');
    86                     $uploadfile = $uploaddir.'/'.$_FILES['userfile']['name'];
     85                    $overrides = array('test_form' => false, 'test_type' => false);
     86                    $file = wp_handle_upload($_FILES['import'], $overrides);
    8787
    88                     if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
    89                     {
    90                         //echo "Upload successful.";
    91                         $blogrolling = false;
    92                         $opml_url = $uploadfile;
    93                     } else {
    94                         echo __("Upload error");
    95                     }
     88                    if ( isset($file['error']) )
     89                        die($file['error']);
     90
     91                    $url = $file['url'];
     92                    $opml_url = $file['file'];
     93                    $blogrolling = false;
    9694                }
    9795
     
    106104                        if ('http' == substr($titles[$i], 0, 4))
    107105                            $titles[$i] = '';
     106                        // FIXME:  Use wp_insert_link().
    108107                        $query = "INSERT INTO $wpdb->links (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
    109108                                VALUES('{$urls[$i]}', '".$wpdb->escape($names[$i])."', '', $cat_id, '".$wpdb->escape($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n";
     
    120119                } // end else
    121120
     121                if ( ! $blogrolling )
     122                    @unlink($opml_url);
    122123?>
    123124</div>
Note: See TracChangeset for help on using the changeset viewer.