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

Discussion in 'ASP .Net' started by Jim in Arizona, Jun 5, 2009.

  1. 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

    --
    Jim in Arizona, Jun 5, 2009
    #1
    1. Advertising

  2. On Jun 5, 7:28 pm, "Jim in Arizona" <> wrote:
    > 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
    Alexey Smirnov, Jun 5, 2009
    #2
    1. Advertising

  3. 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



    --

    "Alexey Smirnov" <> wrote in message
    news:...
    On Jun 5, 7:28 pm, "Jim in Arizona" <> wrote:
    > 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
    Jim in Arizona, Jun 8, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Z2F1cmF2?=

    Uploading Data From MS Acess 2000 ti SQL server 2000

    =?Utf-8?B?Z2F1cmF2?=, Jan 9, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    793
    Mary Chipman [MSFT]
    Jan 9, 2006
  2. =?Utf-8?B?UmV6YQ==?=
    Replies:
    3
    Views:
    17,896
    Carlos Barini
    Jun 7, 2004
  3. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    801
    Kevin Spencer
    May 17, 2005
  4. =?Utf-8?B?SlA=?=
    Replies:
    1
    Views:
    7,288
    Steve C. Orr [MVP, MCSD]
    Aug 10, 2005
  5. Dung Ping
    Replies:
    10
    Views:
    955
    Chaddy2222
    Jan 16, 2006
Loading...

Share This Page