I have a web server running some PHP that checks for an image (curl -F 'imageName=@myimage') and it also checks the POST data for username=&password=.

When the PHP checks _REQUEST I can just do:

curl -F 'imageName=@myimage' 'http://www.example.com/?upload=1&username=test&password=test'

I need to instead check _POST for username and password due to specs. How can I upload the image and have the username=&password= post data?

Any help appreciated!

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

Ah found out one way to do this through the man pages.

Have to use -F 'username=test' -F 'username=test' I can't combine them with &. Weird

If anyone knows another way let me know =)

link|improve this answer
Why is that a problem, anyway? It's not like you have to pay extra for a second -F. (Sorry for that.) You cannot combine them with & because -F makes curl send a multipart/form-data request, which uses a completely different way of separating fields. You could use -d instead, which sends the POST request as application/x-www-form-urlencoded, but it's absolutely unsuitable for file uploads. – grawity Jan 14 '11 at 18:50
@grawity "because -F makes curl send a multipart/form-data request, which uses a completely different way of separating fields. You could use -d instead, which sends the POST request as application/x-www-form-urlencoded, but it's absolutely unsuitable for file uploads." That's exactly what I was looking for. Thanks =) and also, I never said it was a problem that I have to use 8 extra -F (real situation) it's just inconvenient and I didn't know it used a different scheme. – kisplit Jan 14 '11 at 20:02
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.