1

I'm testing PHP CURL on my laptop, but file uploads are blocked by Norton because of negative content length.

So, I think CURL is sending Content-Length: -1.

How do I get around that? By manually setting the content length? If so, what's the best way to do that?

4
  • I'll try this... length of query string + length of files. Then, use CURLOPT_HTTPHEADER to set the content-length. Apr 11, 2012 at 17:12
  • That seemed to work... but now the test hangs... I tried setting session_write_close() in case of a session deadlock, but it didn't seem to help. Apr 11, 2012 at 17:25
  • It looks like Norton is blocking all the CURL calls, whether or not I'm uploading a file. Apr 11, 2012 at 17:51
  • Before I was using http_build_query to pass a string instead of array to CURLOPT_POSTFIELDS, but that won't work for sending files. Apr 11, 2012 at 17:54

1 Answer 1

0

It looks like I had curl_setopt($CURL, CURLOPT_POST, TRUE), and that wasn't a good idea. I removed it, and Norton doesn't complain and the script works.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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