Hi,

I'm working on the Media Multiselect module that enables PLUpload on multi-value Media fields. And on the fields you can specify a file directory (and schema for that matter).
So it basically allows you to specify the schema and directory part of the destination uri.

PLUpload, however, always just uses $destination = variable_get('file_default_scheme', 'public') . '://' . $file_info['name'];

Both core's File module, and File Entity's upload handles this by having the #upload_location-key sat on the file form-element, which then saves it accordingly.

So would it be possible to add support for the #upload_location key?

Regards
Morten Fangel.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fangel’s picture

Issue summary: View changes

Fixed a bug in the proposed code.

slashrsm’s picture

It would be possible :). Can you prepare patch?

fangel’s picture

I'll try. I'm not quite sure how to approach it yet. I had an attempt that didn't work as I wanted it to, so I'll have to dig a little deeper into how PLUpload saves files after upload. Don't know when I'll get the time to look at it though :/

ParisLiakos’s picture

Project: Plupload integration » File Entity (fieldable files)
Version: 7.x-1.x-dev » 7.x-2.x-dev

Actually this issue belongs to file entity....after spending quite some time till i figure out how plupload saves the file, i ended up that file_entity_add_upload_multiple_submit is the one thats responsible for this.
patch soon to come

ParisLiakos’s picture

Status: Active » Needs review
FileSize
1.22 KB

here it is

ParisLiakos’s picture

And this patch provides image scaling to maximum-minimum settings in field configuration...
Although my gut tells me that this is a hack, and plupload does something in the wrong way

ParisLiakos’s picture

Title: Support for upload destination » Respect field settings like minimum - maximum size when used as image field
Project: File Entity (fieldable files) » Plupload integration
Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Needs work

commited #4.
for #5 i think plupload is responsible. so i transfer it back to plupload issue queue

slashrsm’s picture

Status: Needs work » Postponed (maintainer needs more info)

I believe this should already work through #upload_validators:


$form['my_element'] = array(
  '#type' => 'plupload',
  '#title' => t('Upload files'),
  '#description => t('This multi-upload widget uses Plupload library.'),
  '#upload_validators' => array(
    'file_validate_image_resolution' => array('1000', '1000'),
  );
  '#plupload_settings' => array(
    'runtimes' => 'html5',
    'chunk_size => '1mb',
  ),
);
ParisLiakos’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Yeah, well i kept digging this and turns out this is a media issue afterall.
closing this in favor of #1761496: Implement a value_callback for media element

ParisLiakos’s picture

Issue summary: View changes

Proposed code didn't work at all, so removed to avoid confusion.