I’m tring to upload image in wordpress by using some function ..
I found the way to upload images but there are one problem ..
when the user upload his image , wordpress create more than one image diffrent sizes, this is a problem because I want one image only ..
this is wp-conent/uploads/2010/10 folder .. look at the picture (this is one picture but wordpress create same picture but diffrent sizes) .
this is my code
<?php /*
Template Name: Uploading Page
*/?>
<?php get_header();
?><div class="container_12">
<div id="content">
<form id="file-form" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
<p id="async-upload-wrap">
<label for="async-upload">upload</label>
<input type="file" id="async-upload" name="async-upload"> <input type="submit" value="Upload" name="html-upload">
</p>
<p>
<input type="hidden" name="post_id" id="post_id" value="<?php echo '212';?>" />
<?php wp_nonce_field('client-file-upload'); ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
</p>
<p>
<input type="submit" value="Save all changes" name="save" style="display: none;">
</p>
</form>
<?php
if ( isset( $_POST['html-upload'] ) && !empty( $_FILES ) ) {
require_once(ABSPATH . 'wp-admin/includes/admin.php');
$id = media_handle_upload('async-upload', 1199); //post id of Client Files page
unset($_FILES);
if ( is_wp_error($id) ) {
$errors['upload_error'] = $id;
$id = false;
}
if ($errors) {
echo "<p>There was an error uploading your file.</p>";
} else {
echo "<p>Your file has been uploaded.</p>";
}
}
get_sidebar();
get_footer();?>
enter code here
how can make it one picture?
I wish you understand me ^* because my language ><
Perhaps you’ll find something of relevance in the examples given here regarding the media uploader.
http://www.wptavern.com/forum/themes-templates/1346-creating-upload-function-options-page.html
You may also wish to consider posting your question to the WordPress Stack Exchange.