Closed bueckl closed 6 years ago
like you have sequentialUploads
should do it. Anything different between your local machine and your server? PHP version? PHP Modules? Config?
Phew. Solved it. Here's what happened. Composer update installed from cache and didn't fetch the same revision on my local machine as it did on my staging server …
Sorry to bother you. Thanks
Hi again … this is driving me mad.
I thought I had solved it, but "nada", "rien".
The sequentialUploads setting keeps getting ignored. Regarding my server setup: The machine which ignores sequential uploads is running Apache 2.4. My local server is running Apache 2.2 and all seems fine. I'm using the same PHP Version on both (5.5)
$folder = $obj->getCalcAssetsFolderDirectory();
$config = GridFieldConfig_RelationEditor::create(50);
$config->addComponent($Bulk = new GridFieldBulkUpload('Image'));
$Bulk->setConfig('folderName', $folder);
$Bulk->setUfConfig('sequentialUploads', true);
$config->addComponent(new GridFieldBulkManager());
$config->addComponent(new GridFieldGalleryTheme('Image') );
$config->addComponent( $sr = new GridFieldSortableRows('SortOrder') );
$sr->setAppendToTop(false);
$config->removeComponentsByType($config->getComponentByType('GridFieldAddNewButton'));
$config->removeComponentsByType($config->getComponentByType('GridFieldSortableHeader'));
$config->removeComponentsByType($config->getComponentByType('GridFieldFilterHeader'));
$config->removeComponentsByType($config->getComponentByType('GridFieldAddExistingAutocompleter'));
$GridField = new GridField('ImmoImages', 'ImmoImage', $obj->SortedImages(), $config);
$fields->addFieldToTab(
"Root.Bilder",
$GridField
);
Which version of the module are you using? In your code you had once $Bulk->setConfig('sequentialUploads', true);
and another time $Bulk->setUfConfig('sequentialUploads', true);
and those refer to different module version.
If unsure, get the latest master branch and try writing the config like in the doc example here: https://github.com/colymba/GridFieldBulkEditingTools/blob/master/bulkUpload/BULK_UPLOAD.md#uploadfield-configuration
Hi Colymba, I'm using 2.1.1 now … so setUfConfig should be correct …
Yes, make sure to use ->setUfSetup('setFolderName', 'myFolder')
for the folder name.
In any case, not sure why sequential upload would work on a server and not another. Might have to test sequential upload with a normal UploadField, and see if the same happens?
Maybe you can try limiting the concurrent upload instead: https://github.com/blueimp/jQuery-File-Upload/wiki/Options#limitconcurrentuploads
So replace: $Bulk->setUfConfig('sequentialUploads', true);
with $Bulk->setUfConfig('limitConcurrentUploads', 1);
I've bee fiddling a lot with all the config stuff but the only way for me to make sequentialUploads work is to roll back to the 1.6.0 tag. All newer versions break the expected behaviour.
Just tested sequentialUploads
on the latest master branch with $c->getComponentByType('GridFieldBulkUpload')->setUfConfig('sequentialUploads', true);
and it works as expected.
When using sequential upload do you actually see each upload going through 1 by 1? What's wrong with the upload order you are seeing?
No, i don't see the uploads going through 1 by one. Instead it's like 1-5-4-2-3. I can't see any pattern. It's always different. The order the files get uploaded is exactly the order the get written to the db once I press "finish" …
Did you test on a remote server or locally?
My tests are on a virtual machine that match my remote server as close as possible.
Could you check that the config is actually passed to the field front-end as JSON? Can you inspect the "From your computer" upload button and paste here the data-config
attribute.
Also, which CMS/Framework version are you using? Any other gridfield component used?
<input id="Form_ItemEditForm_Image" name="Image[Uploads][]" class="upload ss-upload ss-uploadfield nolabel ss-uploadfield-fromcomputer-fileinput" data-config="{"url":"admin\/migimmobilien\/Immobilie\/EditForm\/field\/Immobilie\/item\/109\/ItemEditForm\/field\/ImmoImages\/bulkupload\/upload?locale=de_DE","urlSelectDialog":"admin\/migimmobilien\/Immobilie\/EditForm\/field\/Immobilie\/item\/109\/ItemEditForm\/field\/ImmoImages\/bulkupload\/select?locale=de_DE","urlAttach":"admin\/migimmobilien\/Immobilie\/EditForm\/field\/Immobilie\/item\/109\/ItemEditForm\/field\/ImmoImages\/bulkupload\/attach?locale=de_DE","urlFileExists":"admin\/migimmobilien\/Immobilie\/EditForm\/field\/Immobilie\/item\/109\/ItemEditForm\/field\/ImmoImages\/bulkupload\/fileexists?locale=de_DE","acceptFileTypes":"(\\.|\\\/)(ace|arc|arj|asf|au|avi|bmp|bz2|cab|cda|css|csv|dmg|doc|docx|flv|gif|gpx|gz|hqx|htm|html|ico|jar|jpeg|jpg|js|kml|m4a|m4v|mid|midi|mkv|mov|mp3|mp4|mpa|mpeg|mpg|ogg|ogv|pages|pcx|pdf|pkg|png|pps|ppt|pptx|ra|ram|rm|rtf|sit|sitx|swf|tar|tgz|tif|tiff|txt|wav|webm|wma|wmv|xhtml|xls|xlsx|xml|zip|zipx)$","maxNumberOfFiles":null,"errorMessages":{"acceptFileTypes":"Dateityp ist nicht erlaubt","maxFileSize":"Dateigr\u00f6\u00dfe \u00fcbersteigt 200 MB","overwriteWarning":"Eine Datei mit dem selben Namen existiert bereits"},"maxFileSize":209715200,"autoUpload":true,"allowedMaxFileNumber":null,"canUpload":true,"canAttachExisting":true,"canPreviewFolder":true,"changeDetection":false,"previewMaxWidth":20,"previewMaxHeight":20,"uploadTemplateName":"ss-uploadfield-uploadtemplate","downloadTemplateName":"colymba-bulkuploaddownloadtemplate","overwriteWarning":true,"sequentialUploads":true}" type="file" multiple="multiple">
"require": {
"php": ">=5.3.2",
"silverstripe/cms": "3.1.9",
"silverstripe/framework": "3.1.9",
"silverstripe/bootstrap-forms": "1.0.1",
"fullscreeninteractive/silverstripe-postmarkmailer": "*",
"micmania1/silverstripe-blog": "dev-master",
"silverstripe/widgets": "dev-master",
"egeloen/google-map": "1.4.0",
"heyday/silverstripe-cacheinclude": "dev-master",
"colymba/gridfield-bulk-editing-tools": "*",
"colymba/gridfield-gallery-theme": "1.0.1",
"axllent/silverstripe-gridfield-paginator-header": "*",
"unclecheese/betterbuttons": "1.2.6",
"undefinedoffset/sortablegridfield": "0.4.1"
},
Thanks colymba!!!
At a first look, the config is indeed passed on, so only thing I can think of is some other component messing things up... Maybe..
Ok, i set up a fresh install on my local machine and deployed to my remote test server:
"require": {
"php": ">=5.3.2",
"silverstripe/cms": "3.1.9",
"silverstripe/framework": "3.1.9",
"silverstripe-themes/simple": "*",
"colymba/gridfield-bulk-editing-tools": "*",
"colymba/gridfield-gallery-theme": "1.0.1",
"undefinedoffset/sortablegridfield": "0.4.1"
}
Here's is my Model:
class ImmoImage extends DataObject {
private static $db = array(
'Title' => 'Varchar(100)',
'Title__en_US' => 'Varchar(100)',
'Title__es_ES' => 'Varchar(100)',
// 'Description' => 'Varchar(255)',
"SortOrder" => "Int"
);
private static $has_one = array(
'Image' => 'Image',
"Page" => "Page"
);
private static $default_sort = "SortOrder";
And the page:
public function getCMSFields() {
$fields = parent::getCMSFields();
$config = GridFieldConfig_RelationEditor::create(50);
$config->addComponent($uf = new GridFieldBulkUpload('Image'));
$config->addComponent(new GridFieldBulkManager());
$config->addComponent(new GridFieldSortableRows('SortOrder'));
$config->addComponent(new GridFieldGalleryTheme('Image'));
$uf->setUfSetup('setFolderName', 'ImmoImages');
$uf->setUfConfig('sequentialUploads', true);
$config->removeComponentsByType($config->getComponentByType('GridFieldAddNewButton'));
$config->removeComponentsByType($config->getComponentByType('GridFieldSortableHeader'));
$config->removeComponentsByType($config->getComponentByType('GridFieldFilterHeader'));
$config->removeComponentsByType($config->getComponentByType('GridFieldAddExistingAutocompleter'));
$GridField = new GridField('ImmoImages', 'ImmoImage', $this->ImmoImages()->sort('SortOrder'), $config);
$fields->addFieldsToTab(
"Root.ImageTest", array(
$GridField
)
);
return $fields;
}
Result: Sequential file uploads are not working on my remote server.
I removed more components
"require": {
"php": ">=5.3.2",
"silverstripe/cms": "3.1.9",
"silverstripe/framework": "3.1.9",
"colymba/gridfield-bulk-editing-tools": "*"
},
still no luck
Out of curiosity which browser are you using? Came across this http://stackoverflow.com/questions/16658408/multiple-file-upload-blueimp-sequentialuploads-true-not-working which apparently sequential upload might be a Firefox/safari issue.
Am always using chrome, so that could explain it....
Yeah, me too. I'm using chrome, but checked in Safari and FF as well …
Me again ;)
This seems to be a network/speed related problem. I can reproduce the error easily by doing the following:
In Chrome: Open the inspector and click the "toggle device mode" icons as you do for mobile testing. Now choose "Generic Notebook" as the device. Then set "Network" to 3G.
When you start uploading files, you'll see, they don't get processed one-by-one. Now switch back to "No throttling" and you will see, how th files get uploaded one-by-one again.
The files I'm using have 2MB - 3MB each.
Another observation I made is, that if you do upload very small files (like 20K). The Upload order always works fine.
I narrowed it down to the _onSend method within UploadField.js which calls the fileexists method … When setting "overwriteWarning" to false instead of true al works fine.
I can confirm that this issue still exists. A temporary "solution" is to disable the overwrite warning (as @bueckl already stated):
$gridFieldBulkUploadField->setUfConfig('overwriteWarning', false);
Would be nice to have a solution that maintains order and gives overwrite warnings, but this might be tricky to implement. Apart from that - thanks for this great plugin :-).
Thanks @sb-relaxt-at. I've market this has upstream
since it is definitely related to either SS implementation or a bug on the JS plugin.
Leaving this open (at least for now) for anyone else running into this.
Not sure upload order can be set in the latest version of uploadfield... so I'll be closing this.
Whoa, I've been using the sequentialUploads
and overwriteWarning
UfConfig options in SilverStripe 3 to fix this for some time now. But I've noticed that we appear to be back to square one with SilverStripe 4.
With SS 4, this module seems to add uploads in an odd order, almost reversed, but with the first and last the wrong way around?
Yet, in @bummzack's sortablefile module it appears to keep the order, based on filename.
I'd appreciate some attention to resolving this, as it's a pretty annoying issue if an image gallery can't maintain image order upon upload.
Apologies, I'd started using @symbiote's GridFieldOrderableRows instead of GridFieldSortableRows and it seems that GridFieldSortableRows isn't applying the SortOrder upon page Publish, so they're all left as 0, resulting in a random order.
After reverting to GridFieldOrderableRows, the SortOrder for each item is set upon hitting Publish and all the images seem to then be in the correct order.
@purplespider sorry I didn't reply earlier.... all the sequentialUploads
are UploadField
specific and this module just act as a kind of proxy to the UploadField
. And am pretty sure sequentialUploads
doesn't exit anymore...
but like you found (https://github.com/silverstripe/silverstripe-asset-admin/issues/767) this is an UploadField
thing...
But -> sequentialUploads is still in the documentation of BulkUploadField!! This should be changed, if the Option (the function setUfConfig) does't exist anymore
I just need this feature desperately ... does anybody know any solution?? Thanks!! Hendrik
Hi there, can somebody give me a hint on how to control the file upload order using GridFieldBulkUpload?
Once I've chosen some files they get uploaded in random order (On my staging server). I've tried different configs and settings but no luck.
On my local machine everything works as expected. Files are uploading one after another.
Cheers