Visualizzazione dei risultati da 1 a 2 su 2

Discussione: upload file

  1. #1

    upload file

    ho sempre utilizzato questo script per caricare immagini sul server con un database access e ha sempre funzionato. ora ho un database mysql e non mi carica piu l'immagine. sapete aiutarmi. sto impazzendo

    percorsoImg = "/immaginiarchivio/"
    ByteRicevuti = Request.TotalBytes

    if ByteRicevuti > 0 then
    DatiRicevuti = Request.BinaryRead(ByteRicevuti)
    For i = 1 To lenB(DatiRicevuti)
    FileBinario = FileBinario & chr(ascB(midB(DatiRicevuti,i,1)))
    Next
    FirmaFile = left(FileBinario,instr(FileBinario,"" & vbCrLf)-1)
    ArrPezzi = split(FileBinario,FirmaFile)

    for item = 1 to ubound(ArrPezzi)-1
    Inizio = instr(ArrPezzi(item),"" & vbCrLf & "" & vbCrLf)
    Intestazione = left(ArrPezzi(item),Inizio-1)
    Inizio = Inizio + len("" & vbCrLf) + len("" & vbCrLf)
    ContenutoFile = mid(ArrPezzi(item),Inizio,len(ArrPezzi(item))-Inizio-1)

    ' Recupero i campi se sono compilati

    if instr(Intestazione,"testo1") > 0 then
    testo1 = ContenutoFile
    end if

    if instr(Intestazione,"testo2") > 0 then
    testo2 = ContenutoFile
    end if

    if instr(Intestazione,"testo3") > 0 then
    testo3 = ContenutoFile
    end if

    if instr(Intestazione,"testo4") > 0 then
    testo4 = ContenutoFile
    end if
    if instr(Intestazione,"testo5") > 0 then
    testo5 = ContenutoFile
    end if

    if instr(Intestazione,"testo6") > 0 then
    testo6 = ContenutoFile
    end if
    if instr(Intestazione,"testo7") > 0 then
    testo7 = ContenutoFile
    end if


    if instr(Intestazione,"file1") > 0 then
    i = instr(Intestazione,"filename=")
    j = instr(i + 10,Intestazione,chr(34))
    NomeUpload = mid(Intestazione,i + 10,j-i-10)
    i = instrRev(NomeUpload,"\")

    if i<>0 then
    NomeFile = mid(NomeUpload,i + 1)
    else
    NomeFile = NomeUpload
    end if

    if i<>0 then
    Set FSO = CreateObject("Scripting.FileSystemObject")
    DimensioneFile1 = len(ContenutoFile)
    EstensioneFile1 = right(ContenutoFile,3)
    NomeFile1 = NomeFile
    Set textStream = FSO.CreateTextFile(Server.MapPath(percorsoImg & NomeFile1), True, False)
    textStream.Write ContenutoFile
    textStream.Close
    Set textStream = Nothing
    Set FSO = Nothing
    end if
    end if

    next

    End if
    %>
    <%
    Dim rs
    Set rs=Server.CreateObject ("ADODB.Recordset")
    rs.Open "SELECT * FROM archivio", conn

    if testo1<>"" and testo2<>"" and testo3<>"" and testo4<>"" and testo5<>"" and testo6<>"" then
    upload1=true
    SQL="Insert Into archivio (giorno, mese, anno, titolo, sottotitolo, testo, immagine)"
    SQL= SQL + "Values ("
    SQL= SQL + "'" + Replace(testo1,"'","''") + "',"
    SQL= SQL + "'" + Replace(testo2,"'","''") + "',"
    SQL= SQL + "'" + Replace(testo3,"'","''") + "',"
    SQL= SQL + "'" + Replace(testo4,"'","''") + "',"
    SQL= SQL + "'" + Replace(testo5,"'","''") + "',"
    SQL= SQL + "'" + Replace(testo6,"'","''") + "',"
    SQL= SQL + "'" + NomeFile + "'"
    SQL= SQL + ")"

    Conn.Execute SQL
    'response.write sql

    elseif testo7="a" then
    if testo2="" or testo3="" or testo4="" or testo5="" or testo6="" then
    Response.Write "<span class='testo'>Tutti i dati sono obbligatori. Inserimento non riuscito</span>"
    end if
    end if



    If Upload1 = true then
    Response.Write "<span class='testo'>l'evento inserito &egrave; " & testo4
    Response.Write "
    La dimensione del file immagine che hai caricato &egrave; di " & DimensioneFile1*0.001 & "kb"
    Response.Write "
    Inserimento riuscito!</span>"
    End If

    %>

  2. #2

    PROBLEMA RISOLTO MA STRANISSIMO

    stavo provando l'area di amministrazione per upload file con Mozilla e non funziona. con explorer funziona tutto alla perfezione.....

    tanto meglio
    però per curiosità qualcuno sa il perchè?

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.