I have a page posting a raw jpg to me via HTTP POST. All reference
I've found is centered around retrieving POST data as name/value pairs
which will not work in this situation.
What I need to do is retrieve the raw POST data and save it as a
jpg.
Here is some php code that does the same thing for reference:
$jfh = fopen($jpeg_fil e, 'w') or die("can't open file");
fwrite($jfh, $GLOBALS['HTTP_RAW_POST_ DATA']);
fclose($jfh);
I assume there is some way to access POST data as a stream and then
write that stream to a file, but it's not clear to me how. Perhaps I
need to use Request.Form.Ge tObjectData, but I'm not sure how to setup
SerializationIn fo and StreamingContex t appropriately.
Any thoughts or suggestions would be much appreciated.
Thanks in advance!
Dan 5 11382
use Request.InputSt ream:
FileStream log = new FileStream("C:\ \dump.tmp",
FileMode.OpenOr Create);
byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputSt ream.Read(buffe r, 0, buffer.Length)) 0)
{
log.Write(buffe r, 0, c);
}
log.Close();
-- bruce (sqlwork.com)
"ma*****@gmail. com" wrote:
I have a page posting a raw jpg to me via HTTP POST. All reference
I've found is centered around retrieving POST data as name/value pairs
which will not work in this situation.
What I need to do is retrieve the raw POST data and save it as a
jpg.
Here is some php code that does the same thing for reference:
$jfh = fopen($jpeg_fil e, 'w') or die("can't open file");
fwrite($jfh, $GLOBALS['HTTP_RAW_POST_ DATA']);
fclose($jfh);
I assume there is some way to access POST data as a stream and then
write that stream to a file, but it's not clear to me how. Perhaps I
need to use Request.Form.Ge tObjectData, but I'm not sure how to setup
SerializationIn fo and StreamingContex t appropriately.
Any thoughts or suggestions would be much appreciated.
Thanks in advance!
Dan
Thanks! That looks like it will do the trick.
The one challenge is that I am also getting data through QueryString.
It looks like using InputStream will put all POST and GET data (and
presumably other Request data like Cookies) together into one file.
I assume that's what's happening since I can't open the jpg after I
save it out.
Is there a way to separate the POST data?
Dan
On Nov 15, 12:48 pm, bruce barker (sqlwork.com)
<brucebarkersql work...@discuss ions.microsoft. comwrote:
use Request.InputSt ream:
FileStream log = new FileStream("C:\ \dump.tmp",
FileMode.OpenOr Create);
byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputSt ream.Read(buffe r, 0, buffer.Length)) 0)
{
log.Write(buffe r, 0, c);
}
log.Close();
-- bruce (sqlwork.com)
"manh...@gmail. com" wrote:
I have a page posting a raw jpg to me via HTTP POST. All reference
I've found is centered around retrieving POST data as name/value pairs
which will not work in this situation.
What I need to do is retrieve the raw POST data and save it as a
jpg.
Here is some php code that does the same thing for reference:
$jfh = fopen($jpeg_fil e, 'w') or die("can't open file");
fwrite($jfh, $GLOBALS['HTTP_RAW_POST_ DATA']);
fclose($jfh);
I assume there is some way to access POST data as a stream and then
write that stream to a file, but it's not clear to me how. Perhaps I
need to use Request.Form.Ge tObjectData, but I'm not sure how to setup
SerializationIn fo and StreamingContex t appropriately.
Any thoughts or suggestions would be much appreciated.
Thanks in advance!
Dan
Consider using an HTTP Sniffer like Fiddler to examine the actual POST so you
can see how it is actually being sent.
--Peter
"Inside every large program, there is a small program trying to get out." http://www.eggheadcafe.com http://petesbloggerama.blogspot.com http://www.blogmetafinder.com
"ma*****@gmail. com" wrote:
Thanks! That looks like it will do the trick.
The one challenge is that I am also getting data through QueryString.
It looks like using InputStream will put all POST and GET data (and
presumably other Request data like Cookies) together into one file.
I assume that's what's happening since I can't open the jpg after I
save it out.
Is there a way to separate the POST data?
Dan
On Nov 15, 12:48 pm, bruce barker (sqlwork.com)
<brucebarkersql work...@discuss ions.microsoft. comwrote:
use Request.InputSt ream:
FileStream log = new FileStream("C:\ \dump.tmp",
FileMode.OpenOr Create);
byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputSt ream.Read(buffe r, 0, buffer.Length)) 0)
{
log.Write(buffe r, 0, c);
}
log.Close();
-- bruce (sqlwork.com)
"manh...@gmail. com" wrote:
I have a page posting a raw jpg to me via HTTP POST. All reference
I've found is centered around retrieving POST data as name/value pairs
which will not work in this situation.
What I need to do is retrieve the raw POST data and save it as a
jpg.
Here is some php code that does the same thing for reference:
$jfh = fopen($jpeg_fil e, 'w') or die("can't open file");
fwrite($jfh, $GLOBALS['HTTP_RAW_POST_ DATA']);
fclose($jfh);
I assume there is some way to access POST data as a stream and then
write that stream to a file, but it's not clear to me how. Perhaps I
need to use Request.Form.Ge tObjectData, but I'm not sure how to setup
SerializationIn fo and StreamingContex t appropriately.
Any thoughts or suggestions would be much appreciated.
Thanks in advance!
Dan
in the html payload, the cookie is in the header, and is just before the
postdata. the url parameters are actuallly on the same line as action
(GET/POST).
see the Request object, you can get the cookie, headers and querystring
(parsed/unparsed).
-- bruce (sqlwork.com)
"ma*****@gmail. com" wrote:
Thanks! That looks like it will do the trick.
The one challenge is that I am also getting data through QueryString.
It looks like using InputStream will put all POST and GET data (and
presumably other Request data like Cookies) together into one file.
I assume that's what's happening since I can't open the jpg after I
save it out.
Is there a way to separate the POST data?
Dan
On Nov 15, 12:48 pm, bruce barker (sqlwork.com)
<brucebarkersql work...@discuss ions.microsoft. comwrote:
use Request.InputSt ream:
FileStream log = new FileStream("C:\ \dump.tmp",
FileMode.OpenOr Create);
byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputSt ream.Read(buffe r, 0, buffer.Length)) 0)
{
log.Write(buffe r, 0, c);
}
log.Close();
-- bruce (sqlwork.com)
"manh...@gmail. com" wrote:
I have a page posting a raw jpg to me via HTTP POST. All reference
I've found is centered around retrieving POST data as name/value pairs
which will not work in this situation.
What I need to do is retrieve the raw POST data and save it as a
jpg.
Here is some php code that does the same thing for reference:
$jfh = fopen($jpeg_fil e, 'w') or die("can't open file");
fwrite($jfh, $GLOBALS['HTTP_RAW_POST_ DATA']);
fclose($jfh);
I assume there is some way to access POST data as a stream and then
write that stream to a file, but it's not clear to me how. Perhaps I
need to use Request.Form.Ge tObjectData, but I'm not sure how to setup
SerializationIn fo and StreamingContex t appropriately.
Any thoughts or suggestions would be much appreciated.
Thanks in advance!
Dan
Thanks. Turned out there was an extra byte in their stream breaking
it, so it's all good. Request.InputSt ream got the raw POST data and
Request.QuerySt ring still gave me the QS vars.
Thanks for all the help!
On Nov 15, 1:26 pm, Peter Bromberg [C# MVP]
<pbromb...@yaho o.NoSpamMaam.co mwrote:
Consider using an HTTP Sniffer like Fiddler to examine the actual POST so you
can see how it is actually being sent.
--Peter
"Inside every large program, there is a small program trying to get out."http://www.eggheadcafe .comhttp://petesbloggerama .blogspot.comht tp://www.blogmetafin der.com
"manh...@gmail. com" wrote:
Thanks! That looks like it will do the trick.
The one challenge is that I am also getting data through QueryString.
It looks like using InputStream will put all POST and GET data (and
presumably other Request data like Cookies) together into one file.
I assume that's what's happening since I can't open the jpg after I
save it out.
Is there a way to separate the POST data?
Dan
On Nov 15, 12:48 pm, bruce barker (sqlwork.com)
<brucebarkersql work...@discuss ions.microsoft. comwrote:
use Request.InputSt ream:
FileStream log = new FileStream("C:\ \dump.tmp",
FileMode.OpenOr Create);
byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputSt ream.Read(buffe r, 0, buffer.Length)) 0)
{
log.Write(buffe r, 0, c);
}
log.Close();
-- bruce (sqlwork.com)
"manh...@gmail. com" wrote:
I have a page posting a raw jpg to me via HTTP POST. All reference
I've found is centered around retrieving POST data as name/value pairs
which will not work in this situation.
What I need to do is retrieve the raw POST data and save it as a
jpg.
Here is some php code that does the same thing for reference:
$jfh = fopen($jpeg_fil e, 'w') or die("can't open file");
fwrite($jfh, $GLOBALS['HTTP_RAW_POST_ DATA']);
fclose($jfh);
I assume there is some way to access POST data as a stream and then
write that stream to a file, but it's not clear to me how. Perhaps I
need to use Request.Form.Ge tObjectData, but I'm not sure how to setup
SerializationIn fo and StreamingContex t appropriately.
Any thoughts or suggestions would be much appreciated.
Thanks in advance!
Dan
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Rasmussen |
last post by:
Some sites seem to be session driven in the sense that if I visit the
homepage and do a few clicks I can navigate anywhere I want, but if I
paste the current location into a new browser window after having
navigated to some page, it doesn't work. It just returns to the start
page or says "timeout" etc.
This means that I can't read these pages from PHP with
$string = file_get_contents('http://some.url/blah/deep/link');
|
by: forums_mp |
last post by:
I've got an STL class (see below) with two functions to store and
retrieve data - msg structs.
The "Store" function when called will copy the received message
(depending on which message) into the appropriate array. For instance
if I receive a RCVD_MSG1, I'll copy into msg1 . Upon receipt of
the next RCVD_MSG1. I'll copy into msg1 .
The Retrieve function when called should retrieve the latest copy.
ie. msg1 or msg1 .
|
by: Daniel Tonks |
last post by:
First, please excuse the fact that I'm a complete MySQL newbie.
My site used forum software that I wrote myself (in Perl) which, up until
now, has used flat files. This worked fine, however lately I've been wanting
to do more stuff with user accounts, and had been eying MySQL for over a
year.
Finally I've decided to start off small by converting the forum's account
system to a MySQL database (and convert the rest later after I'm...
|
by: Vanessa |
last post by:
I have a question, is that any other way to retrieve data from another
webpage besides using XML object? Because I am using XML object now but give
me so much problems.
If I used MSXML2.ServerXMLHTTP object, it gives me time out error:
msxml3.dll error '80072ee2'
The operation timed out
If I used Microsoft.XMLHTTP object, it will hang IE!
|
by: Claudia Fong |
last post by:
Hi,
I have a form where I need to display the data of a department that
stores in a access db.
When I first load the form it will call a function name loaddata which
will get the first record from the db and then display for the user:
oleDbConnection1.Open();
| |
by: onceuponapriori |
last post by:
Greetings gents. I'm a Railser working on a django app that needs to do
some scraping to gather its data.
I need to programatically access a site that requires a username and
password. Once I post to the login.php page, there seems to be a
redirect and it seems that the site is using a session (perhaps a
cookie) to determine whether the user is logged in. So I need to log in
and then have cookies and or sessions maintained as I access...
|
by: Alfred |
last post by:
I want to post text field data from these HTML TEXTAREA tags to a
PostgreSQL database and have it reappear back on another page exactly
as I had typed it. Over the years I have done this but only did it
with simple text. This time around, I want to handle much more complex
text. I need to preserve some kinds of features.
(Yes, I have turned off magic quotes.)
- Need to strip diacritics. I learned I could use htmlentities to
catch...
|
by: Danielle |
last post by:
Hello all,
I'm pretty new to asp.net, I've to do a quick port to ASP.net
I've got a problem I cannot solve: cannot find anything helpfull on
the web.
I've got an HTML form generated from a software i cannot change, so
the form must have to remain pure html.
<form id="form_1" method="POST" action="process.aspx">
<input type="text" id="field_1" value="" />
</form>
|
by: lifeisgreat20009 |
last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please give me some idea where I am going wrong ??
I just want to retrieve data from my emp_mstr table and display it using my JSP file...
The table emp_mstr is as follows :-
CREATE TABLE EMP_MSTR(
EMP_NO VARCHAR(10) PRIMARY KEY,
PASSWORD...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |