ciao a tutti,
codice:<HTML> <HEAD> <TITLE>AspJpeg: da form a disco a db - in asp</TITLE> </HEAD> <BODY> <FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="upload.asp"> <TABLE CELLPADDING="3" CELLSPACING="0" BORDER="0" BGCOLOR="#EEEEEE"> <TR><TD>Immagine:</TD><TD><INPUT TYPE=FILE NAME="MyFile"></TD></TR> <TR><TD>Dimensione anteprima:</TD><TD> <SELECT NAME="scale"> <OPTION VALUE="75">75% <OPTION VALUE="50">50% <OPTION VALUE="25">25% <OPTION VALUE="10">10% </SELECT></TD></TR> <TR><TD>Descrizione:</TD><TD><TEXTAREA NAME="Description"></TEXTAREA></TD></TR> <TR><TD COLSPAN="2"><INPUT TYPE="SUBMIT" VALUE="Upload"></TD></TR> </TABLE> </FORM> </BODY> </HTML>avrei la necessità di:codice:<HTML> <HEAD> <TITLE>AspJpeg </TITLE> </HEAD> <BODY> <% ' Create an instance of AspUpload object Set Upload = Server.CreateObject("Persits.Upload") ' Compute path to save uploaded files to Path = Server.MapPath("/public/") ' Capture uploaded file. Save returns the number of files uploaded Count = Upload.Save(Path) If Count = 0 Then Response.Write "Scegli immagine. riprova." Response.End Else ' Obtain File object representing uploaded file Set File = Upload.Files(1) ' Is this a valid image file? If File.ImageType <> "UNKNOWN" Then ' create instance of AspJpeg object Set jpeg = Server.CreateObject("Persits.Jpeg") ' open uploaded file jpeg.Open( File.Path ) ' resize image accoring to "scale" option. ' notice that we cannot use Request.Form, so we use Upload.Form instead. jpeg.Width = jpeg.OriginalWidth * Upload.Form("scale") / 100 jpeg.Height = jpeg.OriginalHeight * Upload.Form("scale") / 100 SavePath = Path & "\small_" & File.ExtractFileName ' AspJpeg always generates JPEG thumbnails regardless of original format. ' If the original file was not a JPEG, append .JPG extension. If UCase(Right(SavePath, 3)) <> "JPG" Then SavePath = SavePath & ".jpg" End If jpeg.Save SavePath ' Using ADO, save both images in the database along with description. strConnect = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/mdb-database/aspjpeg.mdb") Set rs = Server.CreateObject("adodb.recordset") rs.Open "images", strConnect, 1, 3 rs.AddNew ' Use File.Binary to access binary data of uploaded file. rs("original_image").Value = File.ExtractFileName Set ThumbFile = Upload.OpenFile(SavePath) rs("thumbnail").Value = "\small_" & File.ExtractFileName rs("description") = Upload.Form("Description") rs.Update rs.Close Set rs = Nothing Response.Write "Fatto, sia il file originale che l'anteprima sono stati salvati nel database. " Response.Write "una copia dei files è stata creata in cartella scelta dal webmaster " Else Response.Write "Immagine non valida. riprova." Response.End End If End If %> </BODY> </HTML>
- caricare con un solo campo input più immagini
- nel db oltre nome del file, prima, mi metta il percorso del file (esempio: www.sito.it/public/cartella/img.jpg), questo sia per le anteprime che mi genera che per l'immagine grande
- le antepeime in una cartella e le immagini grandi in un' altra
é complicato?
ma se vorrei inserire altri campi input dove vanno messi? (quello sono capace a farlo)
Grazie mille in anticipo

Rispondi quotando