Closed spacebiscuit closed 2 years ago
You will need to ensure that directory is writeable by the process running your webserver.
Thanks - single upload work so looks like perms are fine. This is how I have the behavior setup
'listing_images[]' => [],
Has this been tested for multiple images on a single upload field? Could I be reporting a feature which isn't supported?
I've not written any tests for that, but I have tested multiple file uploads at once. It should work fine since the cake callback system is scoped per-entity.
I'm certain that it doesn't work, I've tested this comprehensively, The best I can do is save the related hasMany db entries, the files themselves are not processed.
Can you gist what the output form html looks like?
Sorry, at work, otherwise I'd be inclined to test this out again now.
Sure this is the form mark-up:
https://gist.github.com/spacebiscuit/19a3d4f191a2924ab92cf44a5b5b53cf
What are the contents of $this->request->data
?
$this->Request->data added to the gist:
https://gist.github.com/spacebiscuit/19a3d4f191a2924ab92cf44a5b5b53cf
I tried all day to try and modify the plugin to process multiple images, I cannot figure out the basics because there is some very odd behavior occurring that makes testing this next to impossible, I think it might be easier to just write my own module to handle this as the pluginlooks like it might be overkill for my needs.
Can you gist your two models, as well as the controller code? Based on how callbacks work in CakePHP, the submitted data looks fine and it should be saving stuff to disk.
I'm going to assume saving a single file works.
Models as requested:
https://gist.github.com/spacebiscuit/4539b812fd0bba2a3bea9c0b3b3ecf5b
I think the problem is in the beforeSave of uploadedBaehvior in the plugin. It's expecting a single array for the file upload not an arrya of arrays. I thought I could probably wrap this in a loop but it looks like there is more work required.
Right, but each entry in that array should be saved individually, not as a group, so this tells me that its something upstream is going wrong. Let me see if I can get a reproduction in today.
BTW remember that the hasMany table saves correctly so it doesn't look to be a problem with the relations between models.
Yeah thats why it's strange. We should only be getting a single record in that save call, not every record.
Has there been any progress on this front? I feel as thought I have a similar related use, but can't seem to get my head around it. In my case, the database records aren't being created either. The set up is nearly identical to that of the OP.
no recent activity, then, closing ... if you had any issue ask in cake support channels
HI,
I am uploading multiple images on a dingle field, all databse tables are saved correctly;
Entries appear in the listing_images table with the fk correctly set but I no files are on my server. I have set the path to be:
'path' => WWW_ROOT . 'test' . DS,
I've created the folder in my webroot but nothing inside. I am on a windows box running WAMP on localhost. I have tested a custom upload script and that allows me to upload a file so it doesn't appear to be a server issue.
Any ideas?
TY.