Cup Question

56 views
Skip to first unread message

Chris Vaught

unread,
May 26, 2015, 9:05:02 PM5/26/15
to objec...@googlegroups.com
I'm finally switching to Cup for file uploads. Very cool framework but I have a question. What is the simplest way to add additional form data to the file upload? Per the jQuery File Upload documentation you can set formData with an array of property names and values. Does Cup support this directly? If not any insight on how to add support for adding the additional form data.

Thanks
Chris

Richard van Zon

unread,
May 27, 2015, 12:11:12 AM5/27/15
to Chris Vaught, objec...@googlegroups.com
It’s been a while since I used Cup, I am not sure, but I don’t think it's supported.
I use querystrings. Something like:

[cupUploader setURL:@"/photos?user_id=“ + userId+ "&album=1"];

--
You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objectivej+...@googlegroups.com.
To post to this group, send email to objec...@googlegroups.com.
Visit this group at http://groups.google.com/group/objectivej.
For more options, visit https://groups.google.com/d/optout.

Chris Vaught

unread,
May 28, 2015, 11:38:56 AM5/28/15
to objec...@googlegroups.com, crva...@gmail.com
Thanks for the response. Not ideal but that will probably work well enough.

Aparajita Fishman

unread,
May 29, 2015, 4:00:06 AM5/29/15
to objec...@googlegroups.com, crva...@gmail.com
var options = [cup options];

options.formData = whatever;
[cup setOptions:options];

Chris Vaught

unread,
May 29, 2015, 10:12:09 PM5/29/15
to objec...@googlegroups.com, crva...@gmail.com
Thanks Aparajita.

Chris Vaught

unread,
Jun 8, 2015, 4:40:13 PM6/8/15
to objec...@googlegroups.com, crva...@gmail.com
Aparajita,

I have not actually been able to get this to work. I appear to be doing something wrong. Exactly how should the formData be inserted. It seems that it should be set in the manner shown below but this isn't working for me.

var options = [cup options];
options.formData = '{"name":"value"}';
[cup setOptions:options];

Any help would be greatly appreciated.
Chris


On Friday, May 29, 2015 at 3:00:06 AM UTC-5, Aparajita Fishman wrote:

Chris Vaught

unread,
Jun 8, 2015, 9:58:08 PM6/8/15
to objec...@googlegroups.com
I figured this out. I found that this works:

var formData = new FormData();
formData.append('name', 'value');
var options = [cup options];
options.formData = formData;
[cup setOptions:options];

Aparajita Fishman

unread,
Jun 9, 2015, 7:20:55 AM6/9/15
to objec...@googlegroups.com, crva...@gmail.com
When setting options directly, refer to the jQueryFileUpload docs.
Reply all
Reply to author
Forward
0 new messages