File Upload Script !

Discussion in 'Scripts' started by MatriXica, Dec 15, 2008.

  1. #1
    hi out there

    i do need an file upload script

    i need some features like :

    * members login so they can count their files
    * how many times them files have been downloaded
    * delete / add new files to them account
    * more would be helpful

    here are my examples

    EXEMPLE1
    EXEMPLE2

    thanks and your comments are welcomed ;)
     
    MatriXica, Dec 15, 2008 IP
  2. islandhopper8

    islandhopper8 Active Member

    Messages:
    100
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    73
    #2
    You can easily write that in ASP.net

    Here is some code to start with:
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="showpdf._Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <table style="width:100%;">
    <tr>
    <td>
    Select file</td>
    <td>
    &nbsp;</td>
    <td>
    &nbsp;</td>
    </tr>
    <tr>
    <td>
    <asp:FileUpload ID="FileUpload1" runat="server" />
    </td>
    <td>
    &nbsp;</td>
    <td>
    &nbsp;</td>
    </tr>
    <tr>
    <td>
    Description</td>
    <td>
    &nbsp;</td>
    <td>
    &nbsp;</td>
    </tr>
    <tr>
    <td>
    <asp:TextBox ID="TBDescription" runat="server" Width="418px"></asp:TextBox>
    </td>
    <td>
    &nbsp;</td>
    <td>
    &nbsp;</td>
    </tr>
    <tr>
    <td>
    Multiple recipients (up to 10, separate with commas)</td>
    <td>
    &nbsp;</td>
    <td>
    &nbsp;</td>
    </tr>
    <tr>
    <td>
    <asp:TextBox ID="TBRecipients" runat="server" Width="415px"></asp:TextBox>
    </td>
    <td>
    &nbsp;</td>
    <td>
    &nbsp;</td>
    </tr>
    </table>
    </div>
    <p>
    <asp:Button ID="Button1" runat="server"
    Text="Send File" />
    </p>
    </form>
    </body>
    </html>

    Code behind:
    Imports System.Net.Mail
    Imports System.IO
    Partial Public Class _Default

    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    If Not String.IsNullOrEmpty(Me.FileUpload1.FileName) Then
    Dim myFile As HttpPostedFile = FileUpload1.PostedFile
    Dim p As String = Server.MapPath(".")
    myFile.SaveAs(p & "\" & Me.FileUpload1.FileName)
    Dim htmlbody As String = "Here is the file. click to link to download <a href=""www.yourwebsite.com/" & Me.FileUpload1.FileName & """>Click here</a>"
    SendMailMessage(Me.TBRecipients.Text, "File", htmlbody, "from@yourwebsite.com", , p & "\" & Me.FileUpload1.FileName)
    End If

    End Sub

    Public Function SendMailMessage(ByVal recepient As String, ByVal subject As String, ByVal body As String, Optional ByVal from As String = "you@yourwebsite.com", Optional ByVal cc As String = "", Optional ByVal bcc As String = "", Optional ByVal AttFile As String = "") As String
    Dim myMailMessage As New MailMessage()
    If String.IsNullOrEmpty(AttFile) = False Then
    Dim at As New Attachment(AttFile)
    myMailMessage.Attachments.Add(at)
    End If
    myMailMessage.From = New MailAddress(from)
    myMailMessage.To.Add(New MailAddress(recepient))

    If Not bcc Is Nothing And bcc <> String.Empty Then
    myMailMessage.Bcc.Add(New MailAddress(bcc))
    End If

    If Not cc Is Nothing And cc <> String.Empty Then
    myMailMessage.CC.Add(New MailAddress(cc))
    End If

    myMailMessage.Subject = subject
    If body.ToLower.Contains("<html>") = False Then
    body = "<html><head></head><body>" & body & "</body></html>"
    End If
    myMailMessage.Body = body

    myMailMessage.IsBodyHtml = True
    myMailMessage.Priority = MailPriority.Normal
    Dim mySmtpClient As New SmtpClient()
    Dim er As String = Nothing
    Try
    mySmtpClient.Send(myMailMessage)
    Catch ex As Exception
    er = ex.Message
    End Try
    Return (er)
    End Function
    End Class
     
    islandhopper8, Dec 17, 2008 IP
  3. ysribharath

    ysribharath Well-Known Member

    Messages:
    745
    Likes Received:
    10
    Best Answers:
    1
    Trophy Points:
    155
    #3
    demo:

    galaxyscripts(dot)com/demo/

    download

    galaxyscripts(dot)com/download/

    features

    galaxyscripts(dot)com/features/

    enjoy..its simple good and the best
     
    ysribharath, Dec 17, 2008 IP
  4. MatriXica

    MatriXica Active Member

    Messages:
    239
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #4
    i do need it with the login parameters ...
     
    MatriXica, Dec 17, 2008 IP
  5. islandhopper8

    islandhopper8 Active Member

    Messages:
    100
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    73
    #5
    Just create a login page and put the upload page in a folder that is login protected.

    If you are interested I can create a mini site for you in aspx.
     
    islandhopper8, Dec 18, 2008 IP