Use wp_handle_upload().
git-svn-id: http://svn.automattic.com/wordpress/trunk@3360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ca096fabad
commit
94b2a5ad5d
|
@ -82,17 +82,15 @@ foreach ($categories as $category) {
|
||||||
}
|
}
|
||||||
else // try to get the upload file.
|
else // try to get the upload file.
|
||||||
{
|
{
|
||||||
$uploaddir = get_settings('fileupload_realpath');
|
$overrides = array('test_form' => false, 'test_type' => false);
|
||||||
$uploadfile = $uploaddir.'/'.$_FILES['userfile']['name'];
|
$file = wp_handle_upload($_FILES['import'], $overrides);
|
||||||
|
|
||||||
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
|
if ( isset($file['error']) )
|
||||||
{
|
die($file['error']);
|
||||||
//echo "Upload successful.";
|
|
||||||
$blogrolling = false;
|
$url = $file['url'];
|
||||||
$opml_url = $uploadfile;
|
$opml_url = $file['file'];
|
||||||
} else {
|
$blogrolling = false;
|
||||||
echo __("Upload error");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($opml_url) && $opml_url != '') {
|
if (isset($opml_url) && $opml_url != '') {
|
||||||
|
@ -105,6 +103,7 @@ foreach ($categories as $category) {
|
||||||
$titles[$i] = '';
|
$titles[$i] = '';
|
||||||
if ('http' == substr($titles[$i], 0, 4))
|
if ('http' == substr($titles[$i], 0, 4))
|
||||||
$titles[$i] = '';
|
$titles[$i] = '';
|
||||||
|
// FIXME: Use wp_insert_link().
|
||||||
$query = "INSERT INTO $wpdb->links (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
|
$query = "INSERT INTO $wpdb->links (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
|
||||||
VALUES('{$urls[$i]}', '".$wpdb->escape($names[$i])."', '', $cat_id, '".$wpdb->escape($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n";
|
VALUES('{$urls[$i]}', '".$wpdb->escape($names[$i])."', '', $cat_id, '".$wpdb->escape($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n";
|
||||||
$result = $wpdb->query($query);
|
$result = $wpdb->query($query);
|
||||||
|
@ -119,6 +118,8 @@ foreach ($categories as $category) {
|
||||||
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
|
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
|
||||||
} // end else
|
} // end else
|
||||||
|
|
||||||
|
if ( ! $blogrolling )
|
||||||
|
@unlink($opml_url);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue