uploading files on the server and using SQL Xpres05/08 to link

  • Thread starter Thread starter Jim in Arizona
  • Start date Start date
J

Jim in Arizona

I've reached a brick wall with my last attempt to make a simple
upload/download page and storing files in a folder on the hosting computer.
There is a glitch in ASP.NET (or VB.NET or something) that makes this not
happen.

So, I'm wondering about another potential. What about using SQL Express 2008
to store a link to the uploaded file somewhere on the hosting computer? I
can't seem to find any articles about doing this. These files will be large;
upwards of 500 megs each so the 4gb limit in SQL Express isn't an option for
actually storing the files.

TIA,

Jim

--
 
I've reached a brick wall with my last attempt to make a simple
upload/download page and storing files in a folder on the hosting computer.
There is a glitch in ASP.NET (or VB.NET or something) that makes this not
happen.

So, I'm wondering about another potential. What about using SQL Express 2008
to store a link to the uploaded file somewhere on the hosting computer? I
can't seem to find any articles about doing this. These files will be large;
upwards of 500 megs each so the 4gb limit in SQL Express isn't an option for
actually storing the files.

TIA,

Jim

--

Do you mean you can't make it working even with a small file? IIS,
ASP.NET, and browsers limit the size of uploaded files. See more at
http://support.microsoft.com/?id=295626
 
Hi Alexey,

You gave me the link initially that pointed me in the right direction to get
started but I ran into an intersting issue. File size was not a problem
since that limitation could be changed in the web.config file. I wrote a
somewhat long and detailed question on the issue in this newsgroup under the
subject of "virtual directory and hyperlink file path issue (listed and
linked paths don't match)" but no one had a response. Here is that message
in its entirety.

==================================================

Some basic code to display files in a directory, in this case, C:\webfiles

What's interesting is the difference between using system.io.directory and
system.io.directoryinfo classes.
When displaying files simply with directory, I can do this:

Dim filelisting() As String = Directory.GetFiles("C:\webfiles\")
DataGrid1.DataSource = filelisting
DataGrid1.DataBind()

That works just fine, although with no hyperlinks or anything.

When using directoryinfo, I have to do this:

Dim dirinfo As New DirectoryInfo(Server.MapPath(".\webfiles\"))

DataGrid2.DataSource = dirinfo.GetFiles()
DataGrid2.DataBind()

I had originally tried to specifiy Server.MapPath("C:\webfiles\") like with
the directory class but this didn't work. It threw an error saying it was
not a virtual directory. To solve this, I opened IIS up and created a
virtual directory called "webfiles" within the working directory of this
asp.net web form (C:\Inetpub\wwwroot\tests). This virtual directory was
mapped to C:\webfiles. This works fine to display the files, with
hyperlinks, by doing this in the aspx page.

<asp:DataGrid id="DataGrid2" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name"
HeaderText="File Name" />
</Columns>
</asp:DataGrid>

And, in the aspx.vb code behind page (same as shown above):

Dim dirinfo As New DirectoryInfo(Server.MapPath(".\webfiles\"))

DataGrid2.DataSource = dirinfo.GetFiles()
DataGrid2.DataBind()

This works to display the file names in C:\webfiles with hyperlinks, but
when I click on one, I get a 'page cannot be found' message. When looking at
the path when I hover the mouse over the link, it shows:
http://localhost/tests/myfile.doc

It should be showing:

http://localhost/tests/webfiles/myfile.doc

since webfiles is the virtual directory it is getting the file listing from.
If I directly insert that address into the address bar of the web browser, I
get the file.

Other than just placing all the files into the C:\Inetpub\wwwroot\tests
folder and not worrying about virtual directories, how can I solve this
issue. My current environment is a test environment and in the future, in a
production enironment, the virtual folder would probably be a share on
another machine so I'd like to solve this rather than taking the easy way
out and not messing around with virtual directories.

TIA,
Jim
--
==================================================

One thing of note from the problem above is that I don't want everyone to
see the .aspx and .aspx.vb files in the directory listing, which is the case
in the glitch above.

So, since I can't seem to get it going with the filesystem, I was thinking
of using SQL tables with an internal link that pointed to a file somewhere
in the filesystem and, in doing so, hoping to get around the aforementioned
problem(s).

Thank,
Jim



--

I've reached a brick wall with my last attempt to make a simple
upload/download page and storing files in a folder on the hosting
computer.
There is a glitch in ASP.NET (or VB.NET or something) that makes this not
happen.

So, I'm wondering about another potential. What about using SQL Express
2008
to store a link to the uploaded file somewhere on the hosting computer? I
can't seem to find any articles about doing this. These files will be
large;
upwards of 500 megs each so the 4gb limit in SQL Express isn't an option
for
actually storing the files.

TIA,

Jim

--

Do you mean you can't make it working even with a small file? IIS,
ASP.NET, and browsers limit the size of uploaded files. See more at
http://support.microsoft.com/?id=295626
 
Back
Top