Sto creando un sistema di gestione news in ASP con database in Access.
Ci sono alcuni campi, fra cui:
- Titolo
- Introduzione
- Testo
- Scadenza
- Immagine
Il mio problema è fare l'upload dell'immagine ed associare l'immagine appena caricata alla particolare news.
Ho trovato diversi script per fare l'upload di immagini, ma non mi è chiaro come associare un'immagine ad una news.
Se può essere utile, inserisco il codice della pagina di inserimento/modifica della news.
Dopo la scadenza, ho inserito la scritta "Immagine:". Subito dopo vorrei inserire il form per sfogliare e scegliere il file dal disco e farne l'upload su una cartella sul server.
Ma qui mi fermo e mi servirebbe una mano...![]()
Grazie!!!
codice:<%@LANGUAGE="VBSCRIPT" %> <html> <head> <title>Gestione news</title> <script language="Javascript1.2"><!-- // carica l'area html _editor_url = "htmlarea/"; // URL dei file dell'area html var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]); if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; } if (win_ie_ver >= 5.5) { document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"'); document.write(' language="Javascript1.2"></scr' + 'ipt>'); } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); } // --></script> </head> <body> <% set rsOldnews = connect.execute("select id, intestazione, visibile from notizie order by visibile desc") if request("action") = "modifyme" then intID=request("ID") bolVisibile=request("visibile") if bolVisibile=0 then strChecked="" else strChecked="checked" end if set rsNewsToModify = connect.execute ("select id, data, datam, intestazione, introduzione, scadenza, notizia from notizie where id=" & intID & "") txtIntestazione=rsNewsToModify("intestazione") txtNotizia=rsNewsToModify("notizia") txtIntroduzione=rsNewsToModify("introduzione") txtScadenza=rsNewsToModify("scadenza") end if if request("action")="modify" then txtIntestazione=replace(request.form("intestazione"),"'","''") txtNotizia=replace(request.form("testo"),"'","''") txtIntroduzione=replace(request.form("introduzione"),"'","''") intdatam=request.form("datam") chkCheckbox=request.form("checkbox") txtScadenza=request.form("scadenza") intID=request("ID") connect.execute ("update notizie set datam=#"& intdatam &"#, intestazione='" & txtIntestazione &"', notizia='" & txtNotizia & "', introduzione='" & txtIntroduzione & "' , scadenza='" & txtScadenza & "' where id =" & intID & "") if chkCheckbox="" then connect.execute ("update notizie set visibile=0 where id =" & intID & "") else connect.execute ("update notizie set visibile=1 where id =" & intID & "") end if response.redirect "elenco.asp" end if %> <form name="Notizie" method="post" action="modifica_news.asp?action=modify&id=<% =intID %>"> <table width="660" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="30" valign="top"> Mostra notizia <input type="checkbox" name="checkbox" <% =strChecked %>> (spuntare per mostrare la notizia)</td> </tr> <tr> <td>Titolo: <input size="60" type="text" name="intestazione" value="<% =txtIntestazione %>"> </td> </tr> <tr> <td>Introduzione: <textarea name="introduzione" id="introduzione" cols="120" rows="5"><% =txtIntroduzione %></textarea> <input name="datam" type="hidden" value="<% =now()%>"> </td> </tr> <tr> <td>Testo: <textarea name="testo" id="testo" cols="100" rows="10"><% =txtNotizia %></textarea></td> </tr> <tr> <td> </td> </tr> <tr> <td>Scadenza: <input type="text" name="Scadenza" value=<% =txtScadenza %>> </td> </tr> <tr> <td>Immagine: </td> </tr> <tr> <td> <input name="Submit" type="submit" value="Modifica notizia"></td> </tr> <% rsoldnews.close set rsoldnew = Nothing rsNewsToModify.close set rsNewsToModify = Nothing %> </table> </form> <script language="JavaScript1.2" defer> editor_generate('testo'); editor_generate2('introduzione'); </script> </body> </html>

Rispondi quotando