Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are no any way to send file by post #6

Closed
eaxeax opened this issue Jun 6, 2014 · 6 comments
Closed

There are no any way to send file by post #6

eaxeax opened this issue Jun 6, 2014 · 6 comments

Comments

@eaxeax
Copy link

eaxeax commented Jun 6, 2014

i mean, there are no anyway at the moment to do something like this
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "file",
CURLFORM_FILE, "C:\rect.jpg",
CURLFORM_END);

curl_formadd(&post, &last,
CURLFORM_PTRNAME, "fileupload",
CURLFORM_BUFFER, "image",
CURLFORM_BUFFERPTR, png.GetOutputStreamBuffer()->GetBufferStart(),
CURLFORM_BUFFERLENGTH, png.GetOutputStreamBuffer()->GetBufferSize(),
CURLFORM_CONTENTTYPE, "image/png",
CURLFORM_END);

@JosephP91
Copy link
Owner

You're right. I will fix it as soon as possible! Stay tuned for more updates and commits :)

@JosephP91
Copy link
Owner

I found a way to create forms in a flexible way. I will upload new sources as soon as possible! Here's a little sneak peak:

curl_form form;

// create name
curl_form::name name(CURLFORM_PTRNAME,"file_to_upload");
// create content
curl_form::ptr_content content(CURLFORM_BUFFER,buffer,CURLFORM_BUFFERLENGTH,len);
// create content type
curl_form::content_type content_type(CURLFORM_CONTENTTYPE,"image/png");
// add
form.add(name,content,content_type);

@eaxeax
Copy link
Author

eaxeax commented Jun 11, 2014

What do you think about this?

template<typename T, typename T2, typename T3, typename T4, typename T5> CurlHttpPost &CurlHttpPost::formAdd(
const CurlPair<CURLformoption, T> &pair,
const CurlPair<CURLformoption, T2> &pair_2,
const CurlPair<CURLformoption, T3> &pair_3,
const CurlPair<CURLformoption, T4> &pair_4,
const CurlPair<CURLformoption, T5> &pair_5) {
curl_formadd(&this->form_post, &this->last_ptr, pair.first(), pair.second(), pair_2.first(), pair_2.second(),
pair_3.first(), pair_3.second(), pair_4.first(), pair_4.second(), pair_5.first(), pair_5.second(), CURLFORM_END);
return *this;
}

@eaxeax eaxeax closed this as completed Jun 11, 2014
@eaxeax eaxeax reopened this Jun 11, 2014
@JosephP91
Copy link
Owner

Check the commit I just did. Now you should be able to do what you wrote in the first post :) I used a nested class system to split the form creation. Let me know!

@eaxeax
Copy link
Author

eaxeax commented Jun 16, 2014

thanks!

@JosephP91
Copy link
Owner

Thank you!
Let me know if you have any other problem with the library, so we can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants