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! 10 8935
You need to perform a http upload, whether from an asp.net 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*******@disc ussions.microso ft.com> wrote in message
news:91******** *************** ***********@mic rosoft.com... 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!
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.ServerXM LHTTP 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: You need to perform a http upload, whether from an asp.net 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*******@disc ussions.microso ft.com> wrote in message news:91******** *************** ***********@mic rosoft.com... 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!
Here's the code I'm using btw:
Dim http As New MSXML2.ServerXM LHTTP
'Create XMLHTTP/ServerXMLHTTP/WinHttprequest object
'You can use any of these three objects.
' http = CreateObject("W inHttp.WinHttpr equest.5")
' http = CreateObject("M SXML2.XMLHTTP")
http = CreateObject("M SXML2.ServerXML HTTP")
'Open URL As POST request
http.open("POST ", URL, False)
'Set Content-Type header
http.setRequest Header("Content-Type", "multipart/form-data;
boundary=" + Boundary)
http.setRequest Header("name", "datafile")
http.setRequest Header("filenam e", "ocxtest.tx t")
http.setRequest Header("Content-Disposition",
"attachment;fil ename=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=OCXTES T.DOC " + vbCrLf + "Content-Type:
multipart/form-data;" + vbCrLf + vbCrLf
' http.send(d)
http.send(FormD ata)
d = vbCrLf + "--" + Boundary + "--" + vbCrLf
'http.send(d)
MsgBox(FormData )
'Get a result of the script which has received upload
WinHTTPPostRequ est = http.responseTe xt
MsgBox(http.res ponseText)
take a read of this - you may be able to get it working from within word.
You should almost certainly be able to use the IE object example from within
word. http://www.motobit.com/tips/detpg_post-binary-data-url/
--
Regards
John Timney
Microsoft MVP
"Aj Blosser" <Aj*******@disc ussions.microso ft.com> wrote in message
news:C1******** *************** ***********@mic rosoft.com... 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.ServerXM LHTTP 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:
You need to perform a http upload, whether from an asp.net 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*******@disc ussions.microso ft.com> wrote in message news:91******** *************** ***********@mic rosoft.com... > 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!
Hello Aj, 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?
There's really no difference between text and binary data (which is a false
notion anyway): Open the file using a FileStream, load its contents to a
buffer in memory (e.g. a MemoryStream), and post these bytes. If buffernig
in memory isn't required, you can copy the bytes read from the FileStream
directly to your NetworkStream.
Cheers,
--
Joerg Jooss ne********@joer gjooss.de
See, the problem is, when I read the word doc into a filestream,
all I get out of that is:
using .readline 5 or 6 ascii characters. ?'s and blocks.
using .read I get close to the right filesize, but it's all numbers
and using .basestream.rea dbyte it locks up and stalls on me.
any suggestions?
"Joerg Jooss" wrote: Hello Aj,
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?
There's really no difference between text and binary data (which is a false notion anyway): Open the file using a FileStream, load its contents to a buffer in memory (e.g. a MemoryStream), and post these bytes. If buffernig in memory isn't required, you can copy the bytes read from the FileStream directly to your NetworkStream.
Cheers, -- Joerg Jooss ne********@joer gjooss.de
Hello Aj, See, the problem is, when I read the word doc into a filestream, all I get out of that is: using .readline 5 or 6 ascii characters. ?'s and blocks.
Readline() is a StreamReader method. That won't work, as Word files are binary
content.
using .read I get close to the right filesize, but it's all numbers
*Bytes*. But that's what you want! You cannot get a meaningful string representation
of Word document.
Cheers,
--
Joerg Jooss ne********@joer gjooss.de
I guess that's where my confusion is.
So is what your saying, I need to find a way in PHP to convert the bytes to
binary?
"Joerg Jooss" wrote: Hello Aj,
See, the problem is, when I read the word doc into a filestream, all I get out of that is: using .readline 5 or 6 ascii characters. ?'s and blocks.
Readline() is a StreamReader method. That won't work, as Word files are binary content.
using .read I get close to the right filesize, but it's all numbers
*Bytes*. But that's what you want! You cannot get a meaningful string representation of Word document.
Cheers, -- Joerg Jooss ne********@joer gjooss.de
Hello Aj, I guess that's where my confusion is.
So is what your saying, I need to find a way in PHP to convert the bytes to binary?
No, the bytes *are* binary. Just save them in your PHP application to disk
or whatever you need to do.
Cheers,
--
Joerg Jooss ne********@joer gjooss.de This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Caversham |
last post by:
Is there any macro / other tool - free or commercial - that can split
long Word docs into multiple XHTML pages?
Any comments on the quality/effectiveness of suitable products also
welcomed.
|
by: mark kurten |
last post by:
i have a requirement to send a soap message to a web service.
i'm familiar with the soap toolkit using vb.
i need to generate a xml document which i think i can do, but i don't know
how to send it to this service.
i've accessed other web services in .net and usually there are functions i
can reference which do the processing and then return some result.
|
by: Otis Hunter |
last post by:
I have been given an Access Database which contains a table that has
an OLE object field that contains a Word document. That table contains
hundreds of records. I would like to find out how I can write a VB
script, to be executed either within Access or executed at the CMD
prompt, which will loop through all the records and open the document
object and save it to a Word document that I can access from Windows
Explorer. An additional info...
|
by: Neil |
last post by:
An article at http://news.com.com/2100-1012-991694.html?tag=fd_top states:
"XML would allow easier interchange of data generated in
Office documents with back-end systems or existing Web services."
As part of an Access 2000 application, I have to continually parse Word
documents and store the parsings in Access tables using Automation to
control Word and parse the document. Is there a way that XML would help with
that?
Thanks.
|
by: Andy Davis |
last post by:
I have a table of data in Access 2002 which is used as the source table for
a mail merge document using Word 2002 on my clients PC. The data is
transferred OK but I've noticed that any dates which fall between
1stday/anymonth/any year and 12thday/anymonth/any year are rearranged in the
wrong format. For example 4th July 2005 from the database would be displayed
as 07/05/2005 in the merged document. In addition blank date fields from the...
| |
by: Rob Nicholson |
last post by:
We've implemented functionality to allow a user to download a document (any
document type) from the IIS server using the following code:
Response.Clear()
Response.ContentType = "application/x-msdownload"
Response.AddHeader("Content-Disposition", "attachment; filename=" &
System.IO.Path.GetFileName(FilePath))
Response.AddHeader("Content-Length", File.Length.ToString())
Response.WriteFile(FilePath)
Response.End()
|
by: Niyazi |
last post by:
Hi,
I created application that store the data in SQL SERVER that reside on
network. The client also use this application to access the resources
provided with application. But is the client want to register new customer or
companies they will enter the information in Windows Form and the program
automaticaly creates the WORD document under specific folder under
application path. Once the empty word file created than ask user if they want...
|
by: southoz |
last post by:
Good ay all ,
I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information with others. I have seen many request for information on mail merging an how to send data to word documents this is something I have put together with the answers given by others and I hope this will help a few newbies , I know there are easier ways...
|
by: =?Utf-8?B?QXJ0?= |
last post by:
Hello,
I saw this posting and it is the closest place to ask this question. I am
simply trying to create a Word document from a VB application I am wrting
with Visual Studio 2005.
I cut a pasted a simple routine within the 'click' sub-routine and I'm
simple having a problem with resolving the statement 'Dim objWord As New
Word.Application' where it is complaining about 'Word.Application' is not
defined.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |