473,324 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Create Directory and Save files to User's PC

I'm storing files in SQL and retrieving them when needed to the user's
C: Drive

This is accessed on our Intranet site, the problem is the create
directory and saving files happens on the Server not the User's PC

Here is the code
System.IO.Directory.CreateDirectory("C:
\" & fDIR)

Dim fs As New FileStream("c:\" & fDIR & "\" &
filename, FileMode.CreateNew, FileAccess.Write)

Any help would be great
Feb 20 '08 #1
4 1412
On Feb 20, 12:48*pm, kathy30 <kathymar...@yahoo.comwrote:
I'm storing files in SQL and retrieving them when needed to the user's
C: Drive

This is accessed on our Intranet site, *the problem is the create
directory and saving files happens on the Server not the User's PC

Here is the code
* * * * * * * * * * * * * * * * System.IO.Directory.CreateDirectory("C:
\" & fDIR)

* * * * * * * * * * Dim fs As New FileStream("c:\" & fDIR & "\" &
filename, FileMode.CreateNew, FileAccess.Write)

Any help would be great
Just where is the application running?
Feb 20 '08 #2
It runs on our IIS server, the employee use's the web browser.
Searches the database fields and select's Save to create the directory
and save files.

Feb 20 '08 #3
"kathy30" <ka*********@yahoo.comwrote in message
news:83**********************************@u69g2000 hse.googlegroups.com...
I'm storing files in SQL and retrieving them when needed to the user's
C: Drive

This is accessed on our Intranet site, the problem is the create
directory and saving files happens on the Server not the User's PC

Here is the code
System.IO.Directory.CreateDirectory("C:
\" & fDIR)

Dim fs As New FileStream("c:\" & fDIR & "\" &
filename, FileMode.CreateNew, FileAccess.Write)

Any help would be great
You need to set up a UNC path for the user computer:

Dim temp As String = "\\" & Get_IPAddress() & "\C$\"

UNCPath = Application.StartupPath.Replace("C:\", temp)

'----------------------------------------------------------------------

Private Function Get_IPAddress() As String

Dim temp As String = String.Empty

Try

Dim strHostName As String = String.Empty

strHostName = System.Net.Dns.GetHostName()

temp = System.Net.Dns.GetHostEntry(strHostName).AddressLi st(0).ToString()

Catch : End Try

Return temp

End Function


Feb 20 '08 #4
Kathy,

As you want to use standard webpages, then forget it, almost all security
updates are to prevent this kind of stuff, if you found a way then it will
be probably closed tommorow.

Cor

Feb 21 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Glenn Owens | last post by:
As a "newbie" to Javascript I need some help with my latest problem... I have a number of image files that have been pre-selected by the user for downloading. I'd like to be able to have the user...
6
by: E Pease | last post by:
I have been trying to edit the Explorer example by Dev Ashish I found on www.msvp.org (I think). I have been all over the net so I am not quite sure where the file came from. I like the way it...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
2
by: BLetts | last post by:
I have an ASP.NET app that must allow users to upload files. The files are stored in a virtual directory. I use Server.MapPath to map from the virtual directory name to a physical path, then the...
2
by: K. A. | last post by:
I'm trying to write a web site for storing staff ID's together with their photos using a PHP form. A user of the site should be able to enter his ID, name, and select a file from a directory as his...
8
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
0
by: 1333 | last post by:
I need to create a new folder every time the upload folder has 10 files uploaded to it. So when folder1 has 10 files, folder2 is created and becomes the upload folder, and when it has 10 files...
16
by: Mich | last post by:
Hi, i'm building an web application for anonymous users. They can take a look in the website, nothing more. In order to perform other actions, the anonymous user must be logged. So i create an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.