Commit d2a9b67b authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Always post 'upload' param when attempting to upload a file

parent 13b57e36
......@@ -243,7 +243,7 @@ function pieform_element_filebrowser_doupdate(Pieform $form, $element) {
'folder' => $folder,
));
}
else if (!empty($_POST['upload']) || (isset($_FILES['userfile']))) {
else if (!empty($_POST['upload'])) {
if (!isset($_FILES['userfile']['name'])) {
return array(
'error' => true,
......
......@@ -31,6 +31,9 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
setNodeAttribute(self.id + '_userfile', 'disabled', true);
addElementClass(self.id + '_uploadcancel', 'hidden');
}
if (!self.form.upload) {
appendChildNodes(self.form, INPUT({'type':'hidden','name':'upload','value':0}));
}
self.upload_connectbuttons();
}
......@@ -85,11 +88,13 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
}
self.upload_presubmit();
self.form.upload.value = 1;
signal(self.form, 'onsubmit');
self.form.submit();
// $(self.id + '_userfile').value = ''; // Won't work in IE
replaceChildNodes(self.id + '_userfile_container', INPUT({'type':'file', 'class':'file', 'id':self.id+'_userfile', 'name':'userfile', 'size':40}));
connect(self.id + '_userfile', 'onchange', self.upload_submit);
self.form.upload.value = 0;
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment