嘿伙计们,我有一个问题给你, 我有一个设置,我通过POST将文件发送到php网页,我 读取文件内容,将该文件内容作为文本放入POST字符串, 并将其发送给它。 它完美适用于文本文件。但是,我不能打开一个word文档 就像一个文本文件,让它给我我需要的结果。我正在寻找一个 的方式来打开一个word文档并获得所有的值,如果你用记事本打开它就像你将要b $ b。有任何想法吗?或者有关如何通过邮寄更好地发送非文本文件的任何建议?谢谢!
Hey guys, I have a question for you, I have a setup where I''m sending files through the POST to a php web page, I read the file contents, put that file contents as text into the POST string, and send it on it''s way. it works perfectly for text files. However, I can''t open a word document like a text file and have it give me the result I need. I''m looking for a way to just open a word document and get all the values in it like you would if you opened it with notepad. any ideas? or any suggestions on how to better send a non-text file through post? Thanks!
推荐答案您需要执行http上传,无论是来自asp页面,还是来自 应用。 PHP知道如何接受带有附件和单词的表单数据 docs需要通过线路作为完整文件,否则你将获得所有 格式。如果您不需要将其保存为单词doc,请使用单词 自动化打开文档并阅读其内容。 - 问候 John Timney Microsoft MVP " Aj Blosser" < AJ ******* @ discussions.microsoft>在消息中写道 news:91 ********************************** @ microsof t ... You need to perform a http upload, whether from an asp page, or from an application. PHP knows how to accept form data with attachments and word docs need to go over the wire as complete files or you will lsoe all the formatting. If you dont need it preserved as a word doc, use word automation to open the doc and read its contents. -- Regards John Timney Microsoft MVP "Aj Blosser" <Aj*******@discussions.microsoft> wrote in message news:91**********************************@microsof t... 嘿伙计们,我有一个问题,我有一个设置,我通过POST将文件发送到php网页,字符串,并将其发送给它。 它适用于文本文件。但是,我不能像文本文件一样打开word文档,并让它给我我需要的结果。我正在寻找一种方法来打开一个word文档并像你一样获得所有的价值如果你用记事本打开它。有任何想法吗?或者有关如何通过邮寄更好地发送非文本文件的任何建议?谢谢! Hey guys, I have a question for you, I have a setup where I''m sending files through the POST to a php web page, I read the file contents, put that file contents as text into the POST string, and send it on it''s way. it works perfectly for text files. However, I can''t open a word document like a text file and have it give me the result I need. I''m looking for a way to just open a word document and get all the values in it like you would if you opened it with notepad. any ideas? or any suggestions on how to better send a non-text file through post? Thanks!
对,但是有某种上传功能吗?我需要从 应用程序执行此操作,因为它是MS word addin的一部分。截至目前我正在使用 MSXML2.ServerXMLHTTP发送POST请求,但我无法弄清楚的是 如何发送文件。我假设的是身体。 发送方法的参数是针对POST查询字符串的,这可能是我的问题,但是我不能找到任何具体信息。 " John Timney(MVP)"写道: Right, but is there some kind of upload function? I need to do this from an application as It''s part of an MS word addin. as of now I''m using MSXML2.ServerXMLHTTP to send the POST request, but what I can''t figure out is how to send the file over. I''m assuming that the "body" parameter of the send method is for the POST query string, this might be my problem, but I can''t find any specifics on this. "John Timney ( MVP )" wrote: 您需要执行http上传,无论是从asp页面还是从应用程序。 PHP知道如何接受带附件的表单数据和单词 docs需要通过网络作为完整的文件,或者你将lsoe所有格式。如果您不需要将其保存为word文档,请使用Word 自动化打开文档并阅读其内容。 - 问候 John Timney 微软MVP Aj Blosser < AJ ******* @ discussions.microsoft>在消息中写道新闻:91 ********************************** @ microsof t。 .. You need to perform a http upload, whether from an asp page, or from an application. PHP knows how to accept form data with attachments and word docs need to go over the wire as complete files or you will lsoe all the formatting. If you dont need it preserved as a word doc, use word automation to open the doc and read its contents. -- Regards John Timney Microsoft MVP "Aj Blosser" <Aj*******@discussions.microsoft> wrote in message news:91**********************************@microsof t... 嘿伙计们,我有一个问题,我有一个设置,我通过POST将文件发送到php网页,我<读取文件内容,将文件内容作为文本放入POST 字符串,并发送它。 它适用于文本文件。但是,我不能像文本文件一样打开word文档,并让它给我我需要的结果。我正在寻找一种方法来打开一个word文档并像你一样获得所有的价值如果你用记事本打开它。有任何想法吗?或者有关如何通过邮寄更好地发送非文本文件的任何建议?谢谢! Hey guys, I have a question for you, I have a setup where I''m sending files through the POST to a php web page, I read the file contents, put that file contents as text into the POST string, and send it on it''s way. it works perfectly for text files. However, I can''t open a word document like a text file and have it give me the result I need. I''m looking for a way to just open a word document and get all the values in it like you would if you opened it with notepad. any ideas? or any suggestions on how to better send a non-text file through post? Thanks!
这是我正在使用的代码btw: Dim http As New MSXML2.ServerXMLHTTP ''创建XMLHTTP / ServerXMLHTTP / WinHttprequest对象 ''你可以使用这三个对象中的任何一个。 '的' http =的CreateObject(QUOT; WinHttp.WinHttprequest.5") '的' http =的CreateObject(QUOT; MSXML2.XMLHTTP") http = CreateObject(" MSXML2.ServerXMLHTTP") ''打开URL作为POST请求 http.open(" POST", URL,False) ''设置内容类型标题 http.setRequestHeader(" Content-Type"," multipart / form-data; 边界= QUOT; +边界) http.setRequestHeader(QUOT;名称","数据文件") http.setRequestHeader(QUOT ; filename"," ocxtest.txt") http.setRequestHeader(" Content-Disposition" ;, " attachment; filename = mitchell-pres.zip") ''将表单数据发送到URL作为POST二进制请求 Dim d As String d =" - " + Boundary + vbCrLf +" Content-Disposition:form-data; name =''file'';" + filename = OCXTEST.DOC" + vbCrLf +" Content-Type: multipart / form-data;" + vbCrLf + vbCrLf ''http.send(d) http.send(FormData) d = vbCrLf +" ; - " + Boundary +" - " + vbCrLf ''http.send(d) MsgBox(FormData) ''得到一个已收到上传的脚本结果 WinHTTPPostRequest = http.responseText MsgBox(http.responseText) Here''s the code I''m using btw: Dim http As New MSXML2.ServerXMLHTTP ''Create XMLHTTP/ServerXMLHTTP/WinHttprequest object ''You can use any of these three objects. '' http = CreateObject("WinHttp.WinHttprequest.5") '' http = CreateObject("MSXML2.XMLHTTP") http = CreateObject("MSXML2.ServerXMLHTTP") ''Open URL As POST request http.open("POST", URL, False) ''Set Content-Type header http.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + Boundary) http.setRequestHeader("name", "datafile") http.setRequestHeader("filename", "ocxtest.txt") http.setRequestHeader("Content-Disposition", "attachment;filename=mitchell-pres.zip") ''Send the form data To URL As POST binary request Dim d As String d = "--" + Boundary + vbCrLf + "Content-Disposition: form-data; name=''file'';" + " filename=OCXTEST.DOC " + vbCrLf + "Content-Type: multipart/form-data;" + vbCrLf + vbCrLf '' http.send(d) http.send(FormData) d = vbCrLf + "--" + Boundary + "--" + vbCrLf ''http.send(d) MsgBox(FormData) ''Get a result of the script which has received upload WinHTTPPostRequest = http.responseText MsgBox(http.responseText)
更多推荐
使用VB .net 2005通过POST发送word文档
发布评论