Home Forums General Issues Extract a zip file with file upload


Extract a zip file with file upload

  • Hi Guys,
    Hope might someone can help with this or give me some advice. Thanks beforehand.

    I am trying to unzip/extract a file uploaded with the ACF file uploader.

    At the moment I am uploading folders thru FTP with FileZilla and reading/showing the content of it in an iframe in the front end.
    I want to make the process/flow bit easier uploading directly thru WordPress pages with the file uploader.

    This is the code so far.
    I am changing the directory.

    I am not sure if I can write some sort of code inside of this filter or need to be something more complex using the WordPress Filesystem API which I do not have idea how to implemented yet.

    function my_acf_upload_prefilter( $errors, $file, $field ) {
        // only allow admin
        if( !current_user_can('manage_options') ) {
            $errors[] = 'Only administrators may upload attachments';
    	add_filter('upload_dir', 'gist_acf_upload_dir');
        // return
        return $errors;
    add_filter('acf/upload_prefilter/name=zip_files', 'my_acf_upload_prefilter', 10, 3);
    // Custom upload directory
    function gist_acf_upload_dir($param) {
        $custom_dir = '/uploads/jobs2';
        $param['path'] = '.../wp-content' . $custom_dir;
    	$param['url'] = '.../wp-content' . $custom_dir;
    	return $param;


Viewing 1 post (of 1 total)

The topic ‘Extract a zip file with file upload’ is closed to new replies.