form data

1 view
Skip to first unread message

IT2BE

unread,
Feb 23, 2010, 1:15:58 PM2/23/10
to Bombax Support
Hi,

I don't have my best day ever so chances are that I missed it but when
I have a form that loads a file path and I click a 'submit' button.
How do I read the form data?

Thanks,

Marcel

Dominic Blais

unread,
Feb 23, 2010, 1:31:09 PM2/23/10
to bombax-...@googlegroups.com
Hi.  You can either use the 'tempFilePath' or the 'handle' properties to access it.  A rough example:

#import "MyHandler.h"


@implementation MyHandler


- (id)renderWithTransport:(BxTransport *)transport {

    [transport write:@"<html><body><form method='post' enctype='multipart/form-data'>"];

    if ([transport.uploadedFiles count] > 0) {

        BxFile *file = [transport.uploadedFiles objectAtIndex:0];

        [transport writeFormat:@"File:%@ Form:%@ Len:%d Mime:%@<br />", file.fileName, file.formName, file.length, file.mimeType];

        [transport writeFormat:@"Raw Text:<pre>%@</pre>", [NSString stringWithContentsOfFile:file.tempFilePath]];

    }

    [transport write:@"<input type='file' name='yourfile' /><input type='submit' /></form></body></html>"];

    return self;

}


@end


Best wishes for a great tomorrow,
Dominic Blais
COO & Hacker-in-Chief


--
You received this message because you are subscribed to the Google Groups "Bombax Support" group.
To post to this group, send email to bombax-...@googlegroups.com.
To unsubscribe from this group, send email to bombax-suppor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bombax-support?hl=en.


Reply all
Reply to author
Forward
0 new messages