Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    form asp/htm con allegato

    Ciao a tutti, vorrei realizzare una form di iscrizione in asp o html utilizzando possibilmente cdonts / aspformelmail.asp con possibilità di inserire un file immagine (ad esempio max 200kb) che risulterà essere poi allegato nella mail che si riceverà.
    Qualcuno sa aiutarmi?
    grazie
    Rimetta a posto la candela!!

  2. #2
    Utente di HTML.it L'avatar di 99eros9
    Registrato dal
    Jan 2003
    Messaggi
    2,637
    comincia a scaricarti la classe per l'upload di baol quì:
    http://baol.cjb.net/
    se lo vuoi allegare nella mail, un file deve trovarsi nel server.
    Tala är silver men tiga är guld!
    Pubblica il tuo curriculum
    Segnala il tuo sito
    Ancl

  3. #3
    per l'upload ho gia aspsmartupload, li so come impostare anche la dimensione max del file x upload.
    Rimetta a posto la candela!!

  4. #4
    ho trovato questo, e la mail arriva con l'allegato, anche immagine.
    mi serve ora di poter compilare anche altri campi quali ad esempio nome, cognome, email, ecc

    ************************************************** *******************************************
    'You must have ASP SmartUpload Component to be able to use this mail attachment application.
    'Author: Misty Roberts (misty@brightideaweb.com)
    'This code snippet contains three files (sample.htm, sample.asp, and sample2.asp).
    'I got some of the code from http://www.flarehosting.com/support/...sp_upload.asp.
    ************************************************** *******************************************
    Sample.htm:

    <html>
    <head>
    <title> Send Email Attachments </title>











    </head>
    <body>

    <FORM NAME="frmMailAttachment" ACTION="Sample.asp" METHOD="post"
    ENCTYPE="multipart/form-data">


    <TABLE width=400 align=center valign=top cellpadding=2 cellspacing=0 border=0 bgcolor=#cccccc>


    <TR> <TD align="right"><font face=arial size=-1>File</font></TD>
    <TD width="70%"><INPUT TYPE="file" name="file" size="35"></TD></TR>



    <tr>
    <td align=right></td>
    <td align=middle>
    <INPUT

    Type=submit
    Name=subSubmit Value="Submit"><INPUT id=reset1 name=reset1 style="HEIGHT: 24px; WIDTH: 74px" type=reset value="Clear form">

    </td>
    </tr></TABLE></FORM>

    </body>
    </HTML>

    ************
    Sample.asp

    <%
    Dim mySmartUpload 'declare the component
    Dim intCount ' count the number of uploaded files
    Dim File 'declare the file to upload

    intCount=0 'initialize the counter


    'component creation
    Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

    'limit the file size to 50 Kb, Larger size not recommended
    mySmartUpload.MaxFileSize = 50000

    ' limit the file extensions to word documents and text files
    mySmartUpload.allowedFilesList="doc,txt"

    'Select files on the user computer
    mySmartUpload.Upload


    ' checking all the files
    For each file in mySmartUpload.Files
    ' presence test
    If not File.IsMissing then
    ' This uploads the file. Please understand that this path may not work for you. Be sure that you
    'know the file path for your files.
    fic="upload/" &file.FileName&""

    '&FileName&""
    ' backup in database folder
    file.SaveAs(fic)
    ' next file
    intCount = intCount + 1
    End If
    Next

    ' initialize the object
    Set mySmartUpload=nothing

    ' error managment
    If Err.Number=0 then

    direction="Sample2.asp?file=" & fic & ""

    Else
    direction="Sample2.asp?msg=An error as occured. Try again"
    End if


    Response.Redirect direction

    %>


    *************
    Sample2.asp

    <%@ Language=VBScript %>
    <%
    %>
    <HTML>
    <BODY BGCOLOR="white">
    <%
    if IsEmpty(request.querystring("msg")) then

    'declare variables

    Dim MyMail 'The CDO object

    'This depends on your directory structure. You may have to modify this code.
    FileName = "/" & Request.QueryString("File")

    'create a new cdo object
    Set MyMail = Server.CreateObject("CDONTS.NewMail")


    'set its properties
    MyMail.From = "Anywhere" & "<" & "info@anywhere.com" & ">"
    MyMail.To = "someone@any.com"
    'This depends on your directory structure so you may have to modify this code.
    MyMail.AttachFile(server.mapPath(FileName))
    MyMail.Subject = "Attachment"
    MyMail.Body = "Here's an attachment"
    'send the mail
    MyMail.Send
    Set MyMail = Nothing

    'confirm to the user that the mail has been sent
    Response.Write "Message sent to someone@any.com!
    "



    else
    %>
    <%=request.querystring("msg")%>
    <%

    END IF

    %>

    </BODY>

    </HTML>
    Rimetta a posto la candela!!

  5. #5
    non so come far passare i dati dal htm a sample2, visto che l'1 fa solo l'upload, ed il due l'invio a dati preimpostati.
    Rimetta a posto la candela!!

  6. #6
    ho risolto creando una seconda schermata, 2 form.
    mi da invece errore sample.asp quando il file non è con l'estensione indicata o + grande.
    Come posso risolvere. la sintassi mi sembra ok
    Rimetta a posto la candela!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.