Closed (fixed)
Project:
Webform Multiple File Upload
Version:
6.x-1.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 May 2011 at 12:04 UTC
Updated:
2 Feb 2012 at 15:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
attiks commentedPatch attached that uses orig_name if name isn't used
fix for file structure
extra check for theme_webform_display_multifile
Comment #2
cyborg_572 commentedThanks, this seems to work for me.
Comment #3
attiks commentedchanging status
Comment #4
cyborg_572 commentedIt seems I spoke too soon. After patching the transliteration module to support this kind of file array uploading (#1243974: Supporting Files uploaded as an array), the transliteration errors went away and made room for this patch to cause some errors of it's own,.
So basically, removing or repairing Transliteration makes the files upload properly without this patch. If transliteration is present and causing problems, this patch seems to work around them, but without transliteration's errors, this patch just prevents the files from uploading. (specifically, I get this: Warning: basename() expects parameter 1 to be string, array given in file_save_upload() (line 615 of includes/file.inc). and this:
For security reasons, your upload has been renamed to ..
Comment #5
attiks commentedComment #6
cyborg_572 commentedI noticed in the commit logs that you plan to apply this patch. I'm just wondering if you've tried the 6.x-3.x version of Transliteration which seems to fix it from that end? This patch actually causes some conflicts with that one. So either this issue is fixed and the solution is to use Transliteration 6.x-3.x, or the patch is also fixing some other edge case, and needs to take the changes in the transliteration module into account before being applied.
Comment #7
attiks commentedI tried the 6.x-3.x but nothing is working for the moment, or the files aren't listed on the submission, or they are listed as array.
Comment #8
attiks commentedI combined both patches and fixed some typos, it should be OK for transliteration 6.x-3.x branch
Issue #1145490 by attiks: Fixed Files are not saved.
Issue #1246794 by cyborg_572: Added Multiple multifile fields, and scripts in the footer.
Comment #10
flirpkrahusel commentedI just installed the version 6.x-1.1. After submitting a form with a multifile and one or more files attached, I get this warning:
warning: basename() expects parameter 1 to be string, array given in /www/htdocs/[.........]/includes/file.inc on line 577.
... which is the marked line:
Additionally I get the message, that for security reasons the uploaded file has been renamed ("Aus Sicherheitsgründen wurde die hochgeladene Datei in . umbenannt.")
I am using webform 6.x-3.14. Tried the dev version of webform_multifile (6.x-1.x-dev) too, with same results.
Any idea?
Comment #11
attiks commented@flirpkrahusel can you try with the transliteration module installed?
Comment #12
flirpkrahusel commentedHi attiks,
------------
EDIT: Forget about my post further down here. Multifile works perfectly using the dev-version of transliteration.
Thank you for this great module!
------------
thanks for your hint. It works better now: the files are uploaded an everything is fine, but after submitting, the following warnings are shown:warning: preg_match() expects parameter 2 to be string, array given in /www/htdocs/[.........]/sites/all/modules/transliteration/transliteration.inc on line 32.warning: Invalid argument supplied for foreach() in /www/htdocs/[.........]/sites/all/modules/webform_multifile/multifile.inc on line 477.
Below I marked the mentioned lines.transliteration.inc on line 32:function transliteration_process($string, $unknown = '?', $source_langcode = NULL) {
// ASCII is always valid NFC! If we're only ever given plain ASCII, we can
// avoid the overhead of initializing the decomposition tables by skipping
// out early.
if (!preg_match('/[\x80-\xff]/', $string)) {
return $string;
}
multifile.inc on line 477:// Build a human readable list of extensions:$extensions = $component['extra']['filtering']['types'];
$extension_list = '';
if (count($extensions) > 1) {
for ($n = 0; $n < count($extensions) - 1; $n++) {
$extension_list .= $extensions[$n] . ', ';
}
$extension_list .= 'or ' . $extensions[count($extensions) - 1];
}
elseif (!empty($extensions)) {
$extension_list = $extensions[0];
}
if (in_array('jpg', $extensions)) {
$extensions[] = 'jpeg';
}
foreach ($_FILES['files']['name'][$form_key] as $key => $filename) {
$dot = strrpos($filename, '.');
$extension = drupal_strtolower(drupal_substr($filename, $dot + 1));
$file_error = FALSE;
if (!empty($extensions) && !in_array($extension, $extensions)) {
form_error($element, t("Files with the '%ext' extension are not allowed, please upload a file with a %exts extension.", array('%ext' => $extension, '%exts' => $extension_list)));
$file_error = TRUE;
}
Comment #13
jelle_s