Forum for discussing general topics related to Couch.
39 posts Page 3 of 4
GoingMarryAsap wrote:
Take your time mate! I will wait :)


Thanks! It took quite an effort to learn curl and the way to crack this without cutting corners of security and keeping integrity of couch core code intact.

ScreenCut-09-21---22-09-26-.png
Uploading with preview
ScreenCut-09-21---22-09-26-.png (182.78 KiB) Viewed 522 times
@trendoman,

I'm interested in knowing how you solved the issue of multiple (securefile) files upload from the front end.

Could you please share some details? Especially how you used curl to solve the issue.

You mentioned some time ago a tutorial. I looked for it on the forum, maybe I missed it...

Thanks
Olivier
It is fairly simple without curl (though curl option is also valid). Some php used. Please allow me several days to write the tutorial. Is this something you really need?
I'd like to offer the possibility to registered users to perform bulk upload of images (and other files) on member area of the website.
As you remarked at the beginning of forum topic, the securefile tag is doing great for uploading one file from the front end, but not for several files at once.
I'm rather new to couchcms, so any advice on how to solve this limitation is very welcome :)
Let's see into the result of the uploading:

In one case, users are expected to upload 0..N attachments - i mean: 0, 1, 2 or many of them at once. Sometimes it is enough to give them up to, say, 20 attachments total. So we use a predefined set of 20 editables of type='securefile' and fill them with what user submitted.

In another case, users are free to send to you unlimited attachments. And each attachment needs to become a single cloned page in some 'file uploads' template. Very similar to a photo gallery with unlimited photos, which all are stored in a separate gallery template.

Please explain with details which configuration do you want and why. Thanks

PS Think of a mailbox with emails - a template with cloned pages (single emails). Either each email can have up to several attachments and never more. OR each email/cloned page has relations to another template with files and therefore can practically be related to thousands attachments each.
Thanks for your answer. You're right, my question is rather vague. Let me explain a bit more my use case.

Assume that files to upload are images. I'd like to let a registered user create a new page containing all photos that he uploaded from the front end.

As you mentioned, I could use several individual securefile editable fields, but the user experience would be low if he had to upload, say, 20 images. That would mean clicking 20 times the browse button, 20 times for selecting the right file, and 20 more times the ok button...
I would rather prefer having a a form with some text description field, and an upload button that would allow selecting a file, pressing shift key while selecting another file, click on the ok button, and that would upload the 20 images at once.

So I think the second option you mentioned is more suitable. Indeed having a cloned page per image and 1 gallery per upload looks a perfect solution to me. If I could already achieve this, I'll be very happy.

It would also be nice to have the possibility to upload different type of file, for example having MS doc or pdf file. If the gallery is displayed, these files would show the icon associated to the file type, similar to what file explorers do. That's why I had the idea to use the securefile, as it is generic file upload mechanism.

I don't have yet any code ready, apart from the demo one can find in the documentation section. So I'm still looking for the best way to achieve my goal.
Thanks for your reply. Please consider the first option as well, because of your possible hosting disk space limitations.
That would mean clicking 20 times the browse button

The above preocupation is perfectly valid. However I meant it this way: while the page consists of 20 editables in backend, in the front-end user is presented with multi-upload option, i.e. 1 input and 1 submit button. Or any other visual solution, that is dependent on JS. See here for more samples:
http://demo.interface.club/limitless/la ... pload.html
http://demo.interface.club/limitless/la ... strap.html
http://demo.interface.club/limitless/la ... pzone.html

So, now the choice is to either limit uploading with, say, 20 (or 100) files via multi-upload option OR give the user a choice to load a thousand images to your webhost via same multi-upload option. The last one would require enabled curl extension (can be seen if enabled with phpinfo). The first one doesn't require curl, but has an artificial ceiling.
Thanks for this explanation. I start to see how to solve the problem.

Option 1: I can defined a fix number of editable fields on the back end, and add a browser like one of your examples to select multiple files. I believe this would result in a list of files which is then pass to back end. In this scenario I wonder how to map the selected file to each editable defined...

Option 2: Not limit on uploaded file, though require some configuration in the web server.
I have no idea on how to implement this, but that's probably what you wanted to show in the tutorial you mentioned earlier.

I feel that code wise, option 2 would be more elegant, but option 1 is perfectly fine to address my problem.
If you don't mind giving some code details on how the mapping between the several editable input and the client file browser, I'll be very happy :D
OK, thank you for the answer. Indeed, option 1 requires only "mapping" with php. I'll prepare the working code samples very soon.
@trendoman Did you have time to look at the code sample?

... or can anyone else help here please?
39 posts Page 3 of 4

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests