I'm a WordPress beginner and I'm working on a travel directory that user can register and have a front end control panel and have a front end submission form where user can add property description and of course images .

I have a multi site installation but upload settings do not work for front end(max upload file size and file type). I suppose I can use a filter but I could not find something that works for front end... tried several plugins , all work in back end.

Actually I need a step by step help or on line guide I could not find yet.



You have some ways to do that:

In your functions.php or wp-config.php

@ini_set( 'upload_max_size' , '15M' );
@ini_set( 'post_max_size', '15M');
@ini_set( 'max_execution_time', '300' );

In your .htaccess (if you use apache2)

php_value upload_max_filesize 15M
php_value post_max_size 15M
php_value max_execution_time 300
php_value max_input_time 300

If you use nginx

http {
  client_max_body_size 15m;

In your php.ini

upload_max_filesize = 15M
post_max_size = 15M
max_execution_time = 300

They all work, so you can choose what best suits you, the size is set in MB so all the examples above will set the max upload to 15MB.

  • I need to limit max upload for each Image at 200kb, restricte file type upload (only jpg/png and set a minimum Image size ...let' say 900x 400 px
    – webrex
    Jul 20 '17 at 15:52
  • Can you post the code of the form, and the function that receives the request when the form is submited? Jul 20 '17 at 16:12
  • how to add code...i tried but looks weird and does not show correct.
    – webrex
    Jul 20 '17 at 20:52
  • Can you post what you did? Jul 20 '17 at 22:35
  • I will try again
    – webrex
    Jul 21 '17 at 10:37
global $action;
global $edit_id;
global $embed_video_id;
global $option_video;
global $edit_link_details;
$arguments = array(
  'numberposts'     => -1,
  'post_type'       => 'attachment',
  'post_parent'     => $edit_id,
  'post_status'     => null,
  'exclude'         => get_post_thumbnail_id(),
  'orderby'         => 'menu_order',
  'order'           => 'ASC'
 $post_attachments = get_posts($arguments);
 $post_thumbnail_id = $thumbid = get_post_thumbnail_id( $edit_id );

foreach ($post_attachments as $attachment) {
    $preview =  wp_get_attachment_image_src($attachment->ID,                    'wpestate_property_listings');    

        $images .=  '<div class="uploaded_images"                                      data-imageid="'.$attachment->ID.'"><img src="'.$preview[0].'" alt="thumb"          /><i class="fa fa-trash-o"></i>';
        if($post_thumbnail_id == $attachment->ID){
            $images .='<i class="fa thumber fa-star"></i>';
        $images .=  '<div class="uploaded_images" data-imageid="'.$attachment->ID.'"><img src="'.get_template_directory_uri().'/img/pdf.png" alt="thumb" /><i class="fa fa-trash-o"></i>';
        if($post_thumbnail_id == $attachment->ID){
            $images .='<i class="fa thumber fa-star"></i>';

    $images .='</div>';
    $attachid.= ','.$attachment->ID;


<div class="col-md-12" id="new_post2">
<div class="user_dashboard_panel">
<h4 class="user_dashboard_panel_title"><?php  esc_html_e('Listing           Media','wpestate');?></h4>

<div class="col-md-12" id="profile_message"></div>

<div class="col-md-12">
    <div id="upload-container">                 
        <div id="aaiu-upload-container">                 
            <div id="aaiu-upload-imagelist">
                <ul id="aaiu-ul-list" class="aaiu-upload-list"></ul>

            <div id="imagelist">
                    print $images;

            <div id="aaiu-uploader"  class=" wpb_btn-small wpestate_vc_button  vc_button"><?php esc_html_e('Select Media','wpestate');?></div>
            <input type="hidden" name="attachid" id="attachid" value="<?php echo $attachid;?>">
            <input type="hidden" name="attachthumb" id="attachthumb" value="<?php echo $thumbid;?>">
            <p class="full_form full_form_image">
                <?php esc_html_e('*Double Click on the image to select featured. ','wpestate');?></br>
                 <?php esc_html_e('**Change images order with Drag & Drop. ','wpestate');?>

<div class="col-md-4">
        <label for="embed_video_type"><?php esc_html_e('Video from','wpestate');?></label>
        <select id="embed_video_type" name="embed_video_type" class="select-submit2">
            <?php print $option_video;?>

<div class="col-md-4">
       <label for="embed_video_id"><?php esc_html_e('Video id: ','wpestate');?></label>
       <input type="text" id="embed_video_id" class="form-control"  name="embed_video_id" size="40" value="<?php print $embed_video_id;?>">

 <div class="col-md-12" style="display: inline-block;"> 
    <input type="hidden" name="" id="listing_edit" value="<?php echo  $edit_id;?>">
    <input type="submit" class="wpb_btn-info wpb_btn-small wpestate_vc_button  vc_button" id="edit_prop_image" value="<?php esc_html_e('Save', 'wpestate') ?>" />
    <a href="<?php echo  $edit_link_details;?>" class="next_submit_page"><?php esc_html_e('Go to Details settings (*make sure you click save first).','wpestate');?></a>



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.