For Programmers: Free Programming Magazines  


Home > Archive > ASP > May 2006 > Possible to write an image to a file?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Possible to write an image to a file?

2006-05-25, 3:55 am

Using the HttpRequest object to gather material (potentially from an
external server), is it possible to write the response stream into which
ever file type is required e.g. I request not just text, but an image - is
is possible to write the image to file? Or is this just not possible? I can
only find reference to create a text file.

Thanks.


Baconbutty

2006-05-25, 7:56 am


nospam@invalid.invalid wrote:

> Using the HttpRequest object to gather material (potentially from an
> external server), is it possible to write the response stream into which
> ever file type is required e.g. I request not just text, but an image - is
> is possible to write the image to file? Or is this just not possible? I can
> only find reference to create a text file.
>
> Thanks.


This is a useful link.

<URL:http://www.motobit.com/tips/detpg_r...e-binary-files/>

Regards

Julian Turner

Bob Barrows [MVP]

2006-05-25, 6:56 pm

nospam@invalid.invalid wrote:
> Using the HttpRequest object

I think baconbutty provided your answer so I will concentrate on:

There was no way for you to know it (except maybe by browsing through
some
of the previous questions before posting yours - always a recommended
practice), but this is a classic asp newsgroup.
ASP.Net is a different technology from classic ASP.
While you may be lucky enough to find a dotnet-savvy person here who
can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I
suggest
microsoft.public.dotnet.framework.aspnet.

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


2006-05-25, 6:56 pm

> I think baconbutty provided your answer so I will concentrate on:
>
> There was no way for you to know it (except maybe by browsing through
> some
> of the previous questions before posting yours - always a recommended
> practice), but this is a classic asp newsgroup.


Hehe, well Bob, I wasn't even remotely aware that it was an ASP.NET
question. And to be honest, I'm a newbie in ASP and don't even know what the
difference is yet!.

The link above, wasn't exactly spot on in being helpful - have been
following links and ideas, but to no avail as yet. I just thought they'd be
an alternative method to output an image file rather than using
CreateTextFile. But perhaps, as there's no straightforward answer as yet,
there's no simple answer to my question?


Baconbutty

2006-05-25, 6:56 pm


nospam@invalid.invalid wrote:

>
> Hehe, well Bob, I wasn't even remotely aware that it was an ASP.NET
> question. And to be honest, I'm a newbie in ASP and don't even know what the
> difference is yet!.
>
> The link above, wasn't exactly spot on in being helpful - have been
> following links and ideas, but to no avail as yet. I just thought they'd be
> an alternative method to output an image file rather than using
> CreateTextFile. But perhaps, as there's no straightforward answer as yet,
> there's no simple answer to my question?


I am an amateur at this, but AFAIK, there is no simple answer.

I have sucessfully used the information on the link provided (and
connected links referenced in it) to save binary both on the server and
the client (with client security permission of course) using VBScript.

Whether you are using basic ASP on the server, or you are sing to
save the file client side using a responseStream from an
XMLHttpRequest, you must use either ADODB.Stream,
Scripting.FileSystemObject, XPCOM (Firefox) or some other component,
subject to any relevant security restrictions. As noted, VBScript and
JavaScript do not provide binary file handling natively.

I have no experience with ASP.NET, but I believe that it uses the
Microsoft .NET Framework, which provides a large library of components.
I would imagine that this would include binary file handling on the
server. Client side, I think you are still stuck with one of the
options above, and client side security restrictions.

Regards

Julian Turner

Bob Barrows [MVP]

2006-05-25, 6:56 pm

nospam@invalid.invalid wrote:
>
> Hehe, well Bob, I wasn't even remotely aware that it was an ASP.NET
> question. And to be honest, I'm a newbie in ASP and don't even know
> what the difference is yet!.
>


If your pages have .asp for their extension, then it's classic asp.

If they have .aspx, or .ascx, or .asmx (see the commonality?), then it's
ASP.Net.

I assumed that since you said "HTTPRequest", which is an object in the
..Net framework, that you were using .Net. However, if you meant to say
"XMLHTTPRequest", as baconbutty assumed, then it could be classic ASP,
since that is an object in the MSXML Parser which is often used in
pre-.Net applications.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Bob Lehmann

2006-05-25, 9:55 pm

>> Hehe, well Bob, I wasn't even remotely aware that it was an ASP.NET
the[color=darkred]

Oh good. Another newb hunter loose in the woods who isn't sure he's packing
a 30.06 or a squirt gun.
[color=darkred]

It should have been. Or is it because you have no idea what technology
you're even working in?

Bob Lehmann

<nospam@invalid.invalid> wrote in message
news:U5ydnfJvw_6vWejZnZ2dnUVZ8qqdnZ2d@bt
.com...[color=darkred]
>
> Hehe, well Bob, I wasn't even remotely aware that it was an ASP.NET
> question. And to be honest, I'm a newbie in ASP and don't even know what

the
> difference is yet!.
>
> The link above, wasn't exactly spot on in being helpful - have been
> following links and ideas, but to no avail as yet. I just thought they'd

be
> an alternative method to output an image file rather than using
> CreateTextFile. But perhaps, as there's no straightforward answer as yet,
> there's no simple answer to my question?
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com