how to transparently get an image to the server?

J

Jim Hammond

Is there any way to transparently get an image file from the client machine
to the server? I already have a way to transparently generate the file and
query for the file name (all done on the client side), but there doesn't
seem to be any way to send it to the server after that. For files that are
just text, I am able to write their contents to a hidden field, but I can't
do that with an image.

Thanks,

Jim
 
S

Steve C. Orr [MVP, MCSD]

Would you want web sites to be able to transparently upload files from your
hard drive?
Neither would I.
That's why it's not permitted.

If you really need to do this, you'll need to get the user's permission by
having them accept the use of a thick-client component such as an ActiveX
control or a windows forms control.
 
J

Jim Hammond

Thanks, this app runs in a controlled environment, and I already have a .NET
assembly embedded in the page to capture the image from the client's video
camera.

I am currently looking at several possibilities, but it looks like I may
have add a web service to my server, and the client-side assembly could then
send the image to the server using the web service.

I access the functions of the client-side component using a JavaScript
function. Perhaps if I could convert my JavaScript function to C#, then a
component function could return a System.Drawing.Image or a byte[]. I don't
know how I would get either type to the server, but I haven't succeeded in
converting my JavaScript function to C# anyway.

Jim


Would you want web sites to be able to transparently upload files from your
hard drive?
Neither would I.
That's why it's not permitted.

If you really need to do this, you'll need to get the user's permission by
having them accept the use of a thick-client component such as an ActiveX
control or a windows forms control.
 
S

Steve C. Orr [MVP, MCSD]

Yes, it sounds like you're using a good approach.
I think it's a good idea to use C# on the client to accomplish this. A web
service could be useful in conjuntion with this, or you could potentially
use remoting.
I created a similar application using remoting that sends an image across
the network using a stream.
Here's some of the VB.NET code I used:

Dim ms As New System.IO.MemoryStream()
MyImage.Save(ms, Drawing.Imaging.ImageFormat.Jpeg)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com





Jim Hammond said:
Thanks, this app runs in a controlled environment, and I already have a ..NET
assembly embedded in the page to capture the image from the client's video
camera.

I am currently looking at several possibilities, but it looks like I may
have add a web service to my server, and the client-side assembly could then
send the image to the server using the web service.

I access the functions of the client-side component using a JavaScript
function. Perhaps if I could convert my JavaScript function to C#, then a
component function could return a System.Drawing.Image or a byte[]. I don't
know how I would get either type to the server, but I haven't succeeded in
converting my JavaScript function to C# anyway.

Jim


Would you want web sites to be able to transparently upload files from your
hard drive?
Neither would I.
That's why it's not permitted.

If you really need to do this, you'll need to get the user's permission by
having them accept the use of a thick-client component such as an ActiveX
control or a windows forms control.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com




Jim Hammond said:
Is there any way to transparently get an image file from the client machine
to the server? I already have a way to transparently generate the file and
query for the file name (all done on the client side), but there doesn't
seem to be any way to send it to the server after that. For files that are
just text, I am able to write their contents to a hidden field, but I can't
do that with an image.

Thanks,

Jim
 
J

Jim Hammond

Adding a web service to my ASP.NET application and having the client-side
assembly send the image (as a byte[]) to a web service method was easy to
implement and seems to be working well.

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top