Save a file on the Server from Client

  • Thread starter Thread starter Mr Gordonz
  • Start date Start date
M

Mr Gordonz

Hi All,

I want to be able to save a file from the client's PC on the server. The
tricky part is the aspx page is never actually seen by the user. Basically,
I have a VB application running on the client PC, it calls an aspx page and
passes some data as query srtings, including the full path to the relevant
file(s) on the client PC.
For example, the VB app might call the page thus:

http://www.mysite.com/uploadfile.aspx?filename=C:\somefile.doc.

I need the aspx page (upload.aspx) to retrieve the file from the client PC,
and then save it in a subfolder of the application root,

For example: c:\inetpub\wwwroot\mysite\files\somefile.doc

Any help greatly appreciated.

Cheers,

MG
 
the server side part is just a simple page upload aspx, and there are lots
of examples around on how to do this. You will need a VB client that
understands HTTP and for that have a look at this thread

http://forums.devshed.com/t45991/s.html

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
Well, one thing you definitely don't want to do is to have your web server
have file browsing permissions on all of your clients - that would be a huge
security hole. Instead, you should simply post the data. To make it easy,
perhaps you could have a hidden internet control holding an input type=file
control that you can use to post the data, or you could just cook up your
own post mechanism.
 
Hi John,

I'm sorry - I should have made myself more clear. I already have the VB
client - what I need is some sample code for the upload.aspx page. I have
found lots of examples, but all of them use the <input type="file"> HTML
control and the user is prompted on the actual aspx page. In this case the
user will never see the page. I have been unable to find an example that
doesn't make use of the <input type="file"> control. Can you point me to a
forum or something similar with an example of what I am trying to do?

Cheers,

MG
 
I should have mentioned this in my original post but here is how the
application currently works:

The user runs a VB app on his/her PC. The app prompts the user to select a
file (or files). The app then uploads the file(s) to the web server
(effectively pushing the files up). In addition, the app calls an aspx page
and passes the file name (and a few other bits of data) to the page as query
strings. The page then writes the data to the database.

I want to modify the aspx so it pulls the file from the client, as well as
the other things it currently does. The VB app would simply pass all the
relevant info to the page, and the page would do all the work. To prevent
someone calling the page without using the VB app, the app passes an
encrypted string that the page uses to verify that the page has been called
legitimately.

If this presents a security risk, I would be grateful if someone could
explain how.

Cheers,

MG
 
Back
Top