Form Help

TOPIC:

Job offer: Attachement sent as single zip file secured with a default password. 1 week 3 days ago #243422

  • Topic Author
  • trins123
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
Hi.

The attached zip file is being opened in winrar but not with windows explorer.

The password is 12345.

After testing code I see I just want to use one multifile upload field (files) and not together with another upload field - one file (onemorefile).

I think the above end submit works only if both exist, I would just need one (files).

If I use just one upload field and not both, then even winrar does not open the zip file.

My current end submit is (did minor adjustments with zip file name and password field):

xxxxxxxxxxxxxx

ini_set("include_path", '/home/zdnmsi/php:' . ini_get("include_path") );

$this->execPieceByName('ff_InitLib');

if(class_exists('ZipArchive') && version_compare(PHP_VERSION, '7.2.0', '>=') ) {

$recipient = 'info@trins.si'; // admin recipient email

$subject = 'Elektronsko naročanje';

$from = ff_getSubmit('email');
$fromname = ff_getSubmit('name');

// actual field values
$attachments = ff_getSubmit('files', FF_ARRAY); // FF_ARRAY for multiple file uploads
$attachment = ff_getSubmit('onemorefile'); // without FF_ARRAY for single uploads

$attachments = array_merge($attachments, array($attachment)); // we are merging 2 uploads for demonstration. With a single file, this won't be necessary

$body = '';

foreach ($this->maildata as $data) {

// filtering the uploads
if( $data[_FF_DATA_NAME] != 'files' && $data[_FF_DATA_NAME] != 'onemorefile' )
{

$body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";
}
}

// zipping it all
if(count($attachments) != 0) {

// $zip_file = JPATH_SITE . '/media/breezingforms/password_protected_' . $this->record_id . '.zip';
$zip_file = JPATH_SITE . '/media/breezingforms/' . ff_getSubmit('ime') . '_' . ff_getSubmit('priimek') . '_datoteke.zip';

$zip = new ZipArchive();

if ($zip->open($zip_file, ZipArchive::CREATE) === true) {

foreach ($attachments As $file) {

$zip->addFromString(basename($file), file_get_contents($file));
// $zip->setEncryptionName(basename($file), ZipArchive::EM_AES_256, ff_getSubmit('password'));
$zip->setEncryptionName(basename($file), ZipArchive::EM_AES_256, ff_getSubmit('stevilka_kartice_zavarovanja'));

}

$zip->close();

// deleting the uploaded files
foreach ($attachments As $file) {

unlink($file);
}

$this->sendMail($from, $fromname, $recipient, $subject, $body, $zip_file);

$this->sendMail($from, $fromname, ff_getSubmit('Oddelek'), $subject, $body, $zip_file);

// finally deleting the encrypted file
unlink($zip_file);
}
}

}else{

echo 'Requirements for Zipping not fullfilled.';
exit;
}

xxxxxxxxxxxxxxxx

So If I can get it to work with only one multi upload field (files) and succesfully open zip in windows explorer then this would work as intended.

I can give access to backend if needed.

Best regards,

Rok
Attachments:

Please Log in or Create an account to join the conversation.

Job offer: Attachement sent as single zip file secured with a default password. 1 week 3 days ago #243438

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9076
  • Karma: 167
  • Thanks: 737
Hi,

I was spending a few hours on this and there are bad news:

Windows doesn't support AES encryption for password protected zips.
It only supports native WinZip 2.0 password encryption and their own (undocumented) zipping encryption.

The only thing that could potentially work is executing zip on the server using console commands and trying it that way. But this requires you to have a root access to your server to install various things that need to be used as well as php being able to execute command line tasks.

In short: you will need at least a virtual server with root access to make it work with the windows built-in unzipper.

Wouldn't it be better to advise your doctors to install unzip programs that are broadly available in the windows store for free instead?

Regards,
Markus

Please Log in or Create an account to join the conversation.

Job offer: Attachement sent as single zip file secured with a default password. 1 week 2 days ago #243455

  • Topic Author
  • trins123
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 12
  • Thanks: 0
Hi Marcus,

I agree and I will give them the same proposal.

Thank you.

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.044 seconds

July Sale!

Discounts for all of our extensions + support. Ending July 31st!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!