Help required with ASPUpload

S

shoske

Guest
Hi,

we are trying to code an functionality where in we have list of files and their physical path stored in the database.

I need to upload all these files on submitting a page (assuming i have the list in a recordset obained by executing a 'select' statement).

Is this doable?

If so can anybody give me a general idea as to how we can do it or point me to some code snippet that will me achieve it.

Thnx in advance for the help!

-shoske
 
This is a similar database integrated file upload feature that you may be able to adjust to your needs. It enters a record in a database, then redirects the user to a new page where they specify the location of the file to be uploaded from their local drive. (The record ID is passed to the upload page via query string). The upload page then calls the following VB/ASP.NET script to do the actual upload:

Code:
<script language="VB" runat="server">

Private strGalleryPath = "/pubs/"

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
  Dim SourceFile As HttpPostedFile
    'Fetch source file and save it to disk
    SourceFile = Request.Files("file")
	'Save the file with the record ID as the name
    Dim strFileName As String = Request.Form("pubID") & ".pdf"
    SourceFile.SaveAs (Server.MapPath("/pubs/" & strFileName))
	response.Redirect("pub_uploadcomp.asp")
End Sub
</script>

This script assumes that the file type will be .pdf, and a small regular expression subroutine is used to validate this. Please note that the record ID has been stored in a hidden field "pubID" on the upload page form.

The reason I did not use ASPUpload for this is due to the fact that the file size limitation was an issue.


Hope this helps.
 
Back
Top