Support » Plugins » Hacks » Input to receive a picture

  • rsssalice


    i have this code:

    // adjust values here
    $id = "file_info"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == “img1” then $_POST[“img1”] will have all the image urls
    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
    $multiple = true; // allow multiple files upload
    $width = 800; // If you want to automatically resize all uploaded images then provide width here (in pixels)
    $height = 800; // If you want to automatically resize all uploaded images then provide height here (in pixels)
    <div class="form_row clearfix">
    <label><?php echo PHOTOES_BUTTON;?></label>
    <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>" />
    <div class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" id="<?php echo $id; ?>plupload-upload-ui">
        <input id="<?php echo $id; ?>plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" />
        <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
        <?php if ($width && $height): ?>
                <span class="plupload-resize"></span><span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
                <span class="plupload-height" id="plupload-height<?php echo $height; ?>"></span>
        <?php endif; ?>
        <div class="filelist"></div>
    <div class="plupload-thumbs <?php if ($multiple): ?>plupload-thumbs-multiple<?php endif; ?>" id="<?php echo $id; ?>plupload-thumbs">
    <span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span>
    <span id="upload-error" style="display:none"></span>

    [Please post code or markup snippets between backticks or use the code button. As it stands, your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

    i can upload all the picture in one variable,
    how i can add more variable?

    example i want add
    logo picture, is possible ?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz


    I don’t understand what information you need. Here’s some information that may help you.

    You can select multiple images by either Ctrl-Clicking(PC) or Cmd-Clicking(Mac) each image. When the form is submitted, all the selected image URLS are accessed as an array with $_POST[‘file_info’]. To access the first URL, use $_POST[‘file_info’][0], $_POST[‘file_info’][1] for the second, etc. A convenient way to process all elements in an array is to use a PHP foreach loop.

    I hope that helps, if not, perhaps try rephrasing your question in light of the information I provided.

    i have a page with a botton select ( for add a lot of image for gallery )

    but i want add another botton for add a single image to add a logo
    and i want use for a listing page ( to add a gallery and a different logo )


    this is the link for the add listing

    in add page i want a botton add a logo

    and i want use the logo in that page

    Moderator bcworkz


    I understand now, the links were helpful, thanks. What you want is another file input field for a logo image. Unfortunately, your first page does not have any image select field that shows on my browser, nor is there any associated HTML in the source listing. Maybe because I’m not logged in?

    In any case, to answer your question, you can add another file input field right after the first one. Use a different id/name and remove the “multiple” attribute. Something like:
    <input type="file" name="logo">

    Most of my first post’s information is still correct even though I had something else in mind. Except that the multiple image files are in a comma delimited string, not an array, so you would need to explode the string to get an array.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Input to receive a picture’ is closed to new replies.