binary objects in Jscript 
Author Message
 binary objects in Jscript

Hello,

I have a working asp script in VBScript, to take a binary
image object from an HTML form and write it onto the
server.

I want to re-write it in Jscript to integrate it into my
application. I understand fully how it all works, but I
can't seem to find how to hack up the binary 'bytestring'
in Jscript.

I can do a Request.BinaryRead then Response.BinaryWrite,
to prove that I am definitely getting the data from the
form.

The VBscript uses InstrB and MidB to deal with the binary
string, but whenever I try to do anything to it in
Jscript, I just get an error saying that my variable (that
represents the form data) is 'not an Object'. Are there
Jscript equivalents to InstrB and MidB ?

Can anyone simply tell me if it is possible to manipulate
binary objects / bytestrings with Jscipt??

Thanks very much.
Ruaridh.



Fri, 08 Oct 2004 18:20:54 GMT  
 binary objects in Jscript
Ruaridh,

Dunno about binary objects, but javascript (JScript) is totally loosely
typed. This means that a variable can be swapped between integer, string,
floating-point without any need to set the datatype. This is either a huge
bonus or complete madness depending on the way you look at it..

Maybe you should have a look at what sort of datatypes there are..

http://msdn.microsoft.com/library/en-us/script56/html/js56jscondataty...

..as for what you could do to replace IntrB and MidB, you are probably going
to have to swatch the variable to a string (myVar = ""+myVar) then use the
.substr(x[,y])/.indexOf(str)/.lastIndexOf(str) methods.

http://msdn.microsoft.com/library/en-us/script56/html/js56jsmthsubstr...
http://msdn.microsoft.com/library/en-us/script56/html/js56jsmthindexo...
http://msdn.microsoft.com/library/en-us/script56/html/js56jsmthlastin...
sp

Hope this helps...

Ric.


Quote:
> Hello,

> I have a working asp script in VBScript, to take a binary
> image object from an HTML form and write it onto the
> server.

> I want to re-write it in Jscript to integrate it into my
> application. I understand fully how it all works, but I
> can't seem to find how to hack up the binary 'bytestring'
> in Jscript.

> I can do a Request.BinaryRead then Response.BinaryWrite,
> to prove that I am definitely getting the data from the
> form.

> The VBscript uses InstrB and MidB to deal with the binary
> string, but whenever I try to do anything to it in
> Jscript, I just get an error saying that my variable (that
> represents the form data) is 'not an Object'. Are there
> Jscript equivalents to InstrB and MidB ?

> Can anyone simply tell me if it is possible to manipulate
> binary objects / bytestrings with Jscipt??

> Thanks very much.
> Ruaridh.



Fri, 08 Oct 2004 21:33:52 GMT  
 binary objects in Jscript
Hi Ruaridh,

Not with Jscript alone. You'll need a little help from ADODB.Stream/Recordset
to get them down to disk. I knocked up a Jscript class sometime ago for
reading/writing binary objects that might help you along the way.
Haven't tested it in a ASP environment as of yet, but I don't see
any reason it shouldn't run.

http://www.saltstorm.net/depo/binbucket/

usage:
var bb = new BinBucket(Request.BinaryRead(Request.TotalBytes));
bb.save("./binarydata.bin");
--

Thomas.
________________________________S_a_l_t_s_t_o_r_m____

Quote:

> Hello,

> I have a working asp script in VBScript, to take a binary
> image object from an HTML form and write it onto the
> server.

> I want to re-write it in Jscript to integrate it into my
> application. I understand fully how it all works, but I
> can't seem to find how to hack up the binary 'bytestring'
> in Jscript.

> I can do a Request.BinaryRead then Response.BinaryWrite,
> to prove that I am definitely getting the data from the
> form.

> The VBscript uses InstrB and MidB to deal with the binary
> string, but whenever I try to do anything to it in
> Jscript, I just get an error saying that my variable (that
> represents the form data) is 'not an Object'. Are there
> Jscript equivalents to InstrB and MidB ?

> Can anyone simply tell me if it is possible to manipulate
> binary objects / bytestrings with Jscipt??

> Thanks very much.
> Ruaridh.



Sat, 09 Oct 2004 00:14:13 GMT  
 binary objects in Jscript
Thanks for the help guys.
I've written a whole VBscript page that I've integrated
into my application for now, not the tidiest solution but
it works!!.
I'll also check out your Jscript class, Thomas.
Thanks again,
Ruaridh.

Quote:
>-----Original Message-----
>Hi Ruaridh,

>Not with Jscript alone. You'll need a little help from

ADODB.Stream/Recordset
Quote:
>to get them down to disk. I knocked up a Jscript class
sometime ago for
>reading/writing binary objects that might help you along
the way.
>Haven't tested it in a ASP environment as of yet, but I
don't see
>any reason it shouldn't run.

>http://www.saltstorm.net/depo/binbucket/

>usage:
>var bb = new BinBucket(Request.BinaryRead

(Request.TotalBytes));
Quote:
>bb.save("./binarydata.bin");
>--

>Thomas.
>________________________________S_a_l_t_s_t_o_r_m____




Quote:
>> Hello,

>> I have a working asp script in VBScript, to take a
binary
>> image object from an HTML form and write it onto the
>> server.

>> I want to re-write it in Jscript to integrate it into my
>> application. I understand fully how it all works, but I
>> can't seem to find how to hack up the
binary 'bytestring'
>> in Jscript.

>> I can do a Request.BinaryRead then Response.BinaryWrite,
>> to prove that I am definitely getting the data from the
>> form.

>> The VBscript uses InstrB and MidB to deal with the
binary
>> string, but whenever I try to do anything to it in
>> Jscript, I just get an error saying that my variable
(that
>> represents the form data) is 'not an Object'. Are there
>> Jscript equivalents to InstrB and MidB ?

>> Can anyone simply tell me if it is possible to
manipulate
>> binary objects / bytestrings with Jscipt??

>> Thanks very much.
>> Ruaridh.

>.



Sat, 09 Oct 2004 16:01:06 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Binary registry data to Jscript Array?

2. JScript reading a binary file -- HOW?

3. Reading a Binary key from the Registry in JScript

4. Binary in XML and jscript

5. JScript - binary file manipulation

6. Handling Binary Data in JScript

7. read/write binary file in jscript

8. Binary Object Sequence encoded PS

9. Any experience with Binary Object Sequence encoded PS?

10. !Help: Store String in Binary object

11. Useful, free, binary file i/o COM object

12. using methods with JScript objects stored in session object

 

 
Powered by phpBB® Forum Software