[Javascript] Forward image via http with ajax

Terry Riegel riegel at clearimageonline.com
Sat Feb 3 12:52:17 CST 2007

On Feb 3, 2007, at 8:29 AM, John Warner wrote:

> Oops, I really did misunderstand, I thought you were having an issue
> getting the camera to push images "off" the LAN,

I am trying to push images from the camera off the LAN, but using a  
web browser to do so.

> I guess what fooled me was you talking about NAT and port  
> forwarding ect, my bad.

I talked about those only to say that these possible solutions fell  
outside of what I was trying to accomplish. To Port Forward I need  
control of the router. Something I don't always have, so therefore  
this would not be a workable solution.

> So the Internet is NOT involved at all, everything is to happen  
> behind the router?

No the internet is involved. No, part of the solution happens behind  
the router, part of it happens on the internet. Did you see my  
adjustment to your diagram? Once again the pieces involved are...

1. IP camera (LAN)
2. Web Browser (LAN)
3. Router (gateway between LAN and WAN)
4. Web Server (WAN)

I need to move the image from the (1) The IP camera to (4) The Web  
server. I am trying to do this using (3) The web browser as the agent  
to move it.

> In fact if the router were unplugged from the Internet(WAN) this
> would have no impact on our issue;

No not correct, I need a connection to the Web server on the internet.

> ALL browsers will have a 192.168.1.xxx address?

Sort of. All in the context of all devices connected to the router yes.

> When you make an http request to the camera ( what
> specifically are you doing currently? What I mean is do you just type

Yes, that is the server where the image is, and the browser can  
access it, the server can't.
the actual image is more like
<img src=">
In my initial solution I am actually using XMLHttpRequest, but that  
is dropping or ignoring the request as the data being sent is binary.

> into the browser address bar and the image appears along with a  
> control
> set (to take pictures with)? I think in this case you just need to  
> watch
> the traffic a couple of times between the browser and the cgi  
> script on
> the camera  to see what data is passed (mainly browser to camera) and
> you are set.

John, I am not sure how to communicate this any more clearly. I need  
to move an image like...

to a server like...


using a web browser on the same subnet as the camera

> So just to help me understand what exactly is the issue you have?

I don't know how to be any clearer. Anyone else reading in have an  
idea of what is getting missed here. I am not sure what I need to  
communicate at this point.

John. Have you read this whole thread, or just a few of the posts? I  
don't mean to sound condescending, but I am befuddled as to what else  
to say, and am wondering out loud if possible it is because I am  
assuming your posts came after reading the whole thread.


> John Warner
>> -----Original Message-----
>> From: javascript-bounces at LaTech.edu
>> [mailto:javascript-bounces at LaTech.edu] On Behalf Of Terry Riegel
>> Sent: Saturday, February 03, 2007 7:53 AM
>> To: [JavaScript List]
>> Subject: Re: [Javascript] Forward image via http with ajax
>> John,
>> Your understanding of the problem I am attempting to solve is
>> missing
>> some pieces. The main one is your assumption that the browser
>> computer is sitting on the WAN, it is not it is on the LAN. See my
>> inline comments below.
>> You may have been looking at the details of my code and come to that
>> conclusion. I am just testing on a server so the URL's might
>> lead you
>> to believe the setup is different then outlined here.
>> Terry
>> On Feb 3, 2007, at 6:56 AM, John Warner wrote:
>>> How can you contact the cgi script on the server on the
>> camera behind
>>> NAT from the Internet? Example:
>>> Camera
>>> Router (LAN) (WAN)
>>> What call does the browser on the Internet make to get to
>> the camera
>>> without port forwarding?
>> The browser is not on the internet (WAN), it is on the same network
>> (LAN) as the camera
>> Camera
>> Browser
>> Router (LAN) (WAN)
>> Server (WAN)
>> So it really isn't a network issue as the browser can communicate
>> with camera (it can pull the image) and it can communicate with the
>> server (it can push stuff to it). The browser is the tool I
>> am trying
>> to use to take the picture and place it on the server.
>>> Mind this isn't so much a developer question as
>>> a networking question. How would the browser making an HTTP
>> request to
>>> get to the cgi script on the camera with an IP of
>> No that is not the issue. The computer is on the LAN, not the WAN.
>>> Have you considered a Web Service on the LAN, but this would need
>>> forwarding or the computer would need to be put in the DMZ.
>>> There is just no way to handle this otherwise, it isn't a
>> programming
>>> issue so much as a networking problem if I read you
>> correctly below. I
>>> don't think a Java applet pushed out to the clients would
>> solve this
>>> without first addressing the network issue. But the platforms you
>>> mention below all have a JVM available though Palm's is obviously
>>> rather
>>> limited. Note you mention AJAX for this, but does the Palm
>> OS browser
>>> support JavaScript? I just don't see anyway you can handle this
>>> without
>>> setting a 'server' out in the DMZ or port forward to it. Something
>>> other
>>> then the router is going to have to be able to respond when
>> a request
>>> comes in from WAN address. What platform is most common on this LAN
>>> behind the router, Windows?
>>> John Warner
>>>> -----Original Message-----
>>>> From: javascript-bounces at LaTech.edu
>>>> [mailto:javascript-bounces at LaTech.edu] On Behalf Of Terry Riegel
>>>> Sent: Friday, February 02, 2007 8:59 PM
>>>> To: [JavaScript List]
>>>> Subject: Re: [Javascript] Forward image via http with ajax
>>>> Mike,
>>>> Thanks for your comments. After reading your comments I got the
>>>> feeling you may have missed my earlier post to Billy Reisinger. I
>>>> explained with a fair amount of detail what the bigger picture is.
>>>> That with my "more terse" comments below should help you
>> understand
>>>> my requirements.
>>>> Thanks,
>>>> Terry
>>>>> You're talking about taking a single picture, not setting up a
>>>>> streaming video server, right?
>>>> yes
>>>>> You absolutely cannot have the user pick the file they
>> create with
>>>>> the camera?
>>>> Absolutely do not want to even have a file on the
>> computer, just want
>>>> to get it from the camera to the web server w/o port
>> forwarding (NAT
>>>> - Network Address Translation, this is how several computers can be
>>>> "on the internet" with just one router.), and with zero
>> setup on the
>>>> client computer. The only requirement for the client machine is a
>>>> working web browser.
>>>>> Can you use Java?  You might need a signed script to not bug the
>>>>> user with lowering their security.  A Java applet could be called
>>>>> from client-side javascript in your page.
>>>> This is the only option I see meeting most of my
>> requirements, but I
>>>> am generally averse to the idea.
>>>>> Another option would be to compile an app for download that could
>>>>> use xmlhttp outside the browser (or FTP, Soap, whatever)
>>>> Not really this would only work if I had control of the
>> computer that
>>>> would be doing the transfer, something I may or may not
>> have control
>>>> of. It should work on a borrowed computer. Compiling usually means
>>>> you are limited to a particular platform, or platform(s), but it
>>>> would not be feasible to compile for
>>>> Windows/Linux/FreeBSD/Solaris/OS
>>>> X/Palm,... as all of these platforms have web browsers. And what
>>>> about the web browsers that run on platforms I didn't mention.
>>>>> It sounded like you are trying to minimize complexity for
>> the user,
>>>>> which typically means an increase in complexity for the
>>>> developer.  :)
>>>> Yes, I am, yes it does.
>>>>> Since they're already accepting the complexity of the
>> camera hookup
>>>>> and software, you might be able to bundle a "does it all"
>>>>> application to manage it.
>>>> Not true. They do nothing to connect to the camera, except
>> open their
>>>> web browser. This is an IP camera it doesn't connect to a computer,
>>>> it connects to an ethernet hub or router. As long as the
>> browser can
>>>> display jpg images (even that isn't required) the
>> application should
>>>> work.
>>>>> Just curious, what do you mean "..without configuring a router to
>>>>> port forward"?
>>>> google "port forward".
>>>>>> I am working with a IP camera that is able to display an
>> image on
>>>>>> my  web browser (since my computer and the camera are on
>> the same
>>>>>> network  intranet) I would like to push that image via
>> javascript
>>>>>> up to my web  server (internet). This would allow me capture an
>>>>>> image without configuring a router to port forward.
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript

More information about the Javascript mailing list