200 points for help Curl set Httpheader upload file Problem! (Supplementary questions)
PHP Code
$boundary = MD5 (Time ()), $postStr = ""; $postStr. = "--". $boundary. " \ r \ n "; $postStr. =" Content-disposition:form-data; Name=\ "Uptxt[]\"; Filename=\ "index_1.html\" \ r \ n "; $postStr. =" content-type:text/html\r\n\r\n "; $postStr. = $uploadFile." \ r \ n "; #这里是部分文件内容 $postStr. = "--". $boundary. " \ r \ n ";
$postStr. = "Content-disposition:form-data; Name=\ "Uptxt[]\"; Filename=\ "index_1.html\" \ r \ n ";
$postStr. = "content-type:text/html\r\n\r\n";
Switch
$postStr. = "Content-disposition:form-data; Name=\ "Uptxt[]\"; Filename=\ "Index_1.html\" "; Delete \ r \ n
$postStr. = "Content-type:text/html"; Delete \ r \ n
After that, you can upload it successfully.
And
$postStr. = "Content-disposition:form-data; Name=\ "Uptxt[]\"; Filename=\ "index_1.html\" \ r \ n ";
$postStr. = "content-type:text/html\r\n\r\n";
Switch
$postStr. = ' Content-disposition:form-data; Name= "uptxt[]"; Filename= "index_1.html" \ r \ n ';//change to single quote, \ r \ n no longer escaped
$postStr. = ' content-type:text/html\r\n\r\n '; Change to single quote, \ r \ n no longer escaped
can also upload successfully, solve
------Solution--------------------
As you change, I test, the receiving side, not getting to the desired information
or post the full code to see?
------Solution--------------------
Agreement is to be observed, if not observed, the consequences of unpredictable.
You can request success, but will let the Web server resolve HTTP when the chaos,/number and line break are important symbol flags.
For example now boundary block, note content-type:text~html, remove \ r \ n and replace/change ~
PHP Code
$boundary = MD5 (time ()); $postStr = ""; $postStr. = "--". $boundary. " \ r \ n "; $postStr. =" Content-disposition:form-data; Name=\ "Uptxt[]\"; Filename=\ "Index_1.html\" "$postStr. =" Content-type:text~html "; $postStr. = "123\r\n"; #这里是部分文件内容 $postStr. = "--". $boundary. " \ r \ n ";
------Solution--------------------
Didn't you use curl? The online search for a paragraph is this:
Perl Code
------Solution--------------------
discuss
Agreement is to be observed, if not observed, the consequences of unpredictable.
You can request success, but will let the Web server resolve HTTP when the chaos,/number and line break are important symbol flags.