WordPress.org

Support

Support » Plugins and Hacks » delete files from front-end

delete files from front-end

Viewing 12 replies - 1 through 12 (of 12 total)
  • nicole2292
    Member

    @nicole2292

    I would also like this feature. I think it is pointless not to show a thumbnail preview of the uploaded images and a delete function on the front end after upload.

    lupetu
    Member

    @lupetu

    I’m putting in another vote for this delete feature. Would be very useful

    julia227
    Member

    @julia227

    Is there a way to have uploaded files automatically post to a page?

    julia227
    Member

    @julia227

    How can I create a drop-down selection of different category types for when the user uploads a file? Thanks!

    We want answers to above questions .. author should reply otherwise there is no use of this discussion page

    Plugin Author Rinat Khaziev
    Participant

    @rinatkhaziev

    Hey Daelorn,

    Currently there’s no way to do so. What would be the use case for allowing users to delete files that they just uploaded?

    nicole2292,

    Currently there’s no way to do so. It’s planned for future releases though.

    julia227,

    For now you can only set one category via shortcode parameters.

    lunatic4_u,

    This is a free software that I develop and maintain whenever I have a spare minute, so telling what should I do is at least inconsiderate 😉

    Hi Rinat,

    Thanks for your reply.
    Well, there can be several reasons:

    1. Uploaded wrong file
    2. Upload revised version
    3. Simply delete a file that is not actual anymore.

    We don’t want the user to contact us each time they wish to delete one of their files.

    Plugin Author Rinat Khaziev
    Participant

    @rinatkhaziev

    Hey Daelorn,

    It’s pretty easy to implement for registered users (because we could store uploader’s id and that way add a relationship with the upload), but I’m not sure what would be a bulletproof solution for unregistered users. I could store a cookie indicating what uploads this user had made but it’s not very reliable. I’m open to your ideas.

    Well, I’m actually looking for a solution where only registered members can add/delete files, so I’m fine with the first.

    However, I’m not sure what the others want. Maybe you could have a look at the rtmedia plugin. They do it for images.

    RobinWebber
    Member

    @robinwebber

    Hi there,

    Great plugin! Is it already possible to delete files from the front end? I would like this functionality too, for registered members.

    Thank you!

    Murilo Pinto Pereira
    Member

    @murilo-pinto-pereira

    Hi there!

    Its possible delete images in front-end.
    I got this with non-admin users.

    I use:
    in HTML:

    <a class="remImage" name="<?php echo $image->ID; ?>" href="#" onclick="delete_image(<?php echo $image->ID; ?>)"><?php _e('delete');?></a>

    JQuery

    function delete_image(id_image) {
    
        var attID = id_image;
        jQuery.ajax({
            type: 'post',
            url: '/wp-admin/admin-ajax.php',
            data: {
                action: 'delete_attachment',
                att_ID: id_image,
                _ajax_nonce: jQuery('#nonce').val(),
                post_type: 'attachment'
            },
            success: function() {
                console.log('#file-'+attID)
                $('#file-'+attID).fadeOut();
    			window.location.reload();
            }
    	});
    };

    in functions.php

    add_action( 'wp_ajax_delete_attachment', 'delete_attachment' );
    function delete_attachment( $post ) {
        //echo $_POST['att_ID'];
        $msg = 'Attachment ID [' . $_POST['att_ID'] . '] has been deleted!';
        if( wp_delete_attachment( $_POST['att_ID'], true )) {
            echo $msg;
        }
        die();
    }

    RobinWebber
    Member

    @robinwebber

    Thank you so much!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘delete files from front-end’ is closed to new replies.