Visualizzazione dei risultati da 1 a 8 su 8
  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2007
    Messaggi
    66

    Problema con Uploand di html.it

    salve a tutti ho scaricato da html.it il seguete codice per effettuare l'upload di file, ma provando il locale e inserendo il percoso "/" non riesco a vedere o forse non fa l'upload dei file, sapreste aiutarmi??
    Ecco il codice

    <%
    'Questa variabile setta il percorso di dove effettuare l'upolad
    'la cartella non puo non esistere lo script non la crea ! ! !

    percorso = "/"

    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,"sezione") > 0 then
    sezione = ContenutoFile
    end if
    if instr(Intestazione,"categoria") > 0 then
    categoria = ContenutoFile
    end if
    if instr(Intestazione,"descrizione") > 0 then
    descrizione = ContenutoFile
    end if
    if instr(Intestazione,"prov") > 0 then
    prov = ContenutoFile
    end if
    if instr(Intestazione,"comune") > 0 then
    comune = ContenutoFile
    end if
    if instr(Intestazione,"indirizzo") > 0 then
    indirizzo = ContenutoFile
    end if
    if instr(Intestazione,"telefono") > 0 then
    telefono = ContenutoFile
    end if
    if instr(Intestazione,"fax") > 0 then
    fax = ContenutoFile
    end if
    if instr(Intestazione,"url") > 0 then
    url = ContenutoFile
    end if
    if instr(Intestazione,"email") > 0 then
    email = ContenutoFile
    end if
    if instr(Intestazione,"nominativa") > 0 then
    nominativo = ContenutoFile
    end if
    if instr(Intestazione,"email2") > 0 then
    email2 = ContenutoFile
    end if
    if instr(Intestazione,"telefono2") > 0 then
    telefono2 = ContenutoFile
    end if
    if instr(Intestazione,"rs") > 0 then
    rs = ContenutoFile
    end if
    if instr(Intestazione,"iva") > 0 then
    iva = ContenutoFile
    end if
    if instr(Intestazione,"prov2") > 0 then
    prov2 = ContenutoFile
    end if
    if instr(Intestazione,"comune2") > 0 then
    comune2 = ContenutoFile
    end if
    if instr(Intestazione,"indirizzo2") > 0 then
    indirizzo2 = ContenutoFile
    end if
    if instr(Intestazione,"cap") > 0 then
    cap = ContenutoFile
    end if
    if instr(Intestazione,"nc") > 0 then
    nc = ContenutoFile
    end if
    if instr(Intestazione,"telefono3") > 0 then
    telefono3 = ContenutoFile
    end if
    if instr(Intestazione,"fax2") > 0 then
    fax2 = ContenutoFile
    end if


    ' Qui recupero il file da uploadare (se presente) e lo scrivo
    ' sul server
    if instr(Intestazione,"file") > 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")
    Upload1 = True
    DimensioneFile1 = len(ContenutoFile)
    EstensioneFile1 = right(ContenutoFile,3)
    NomeFile1 = NomeFile
    Set textStream = FSO.CreateTextFile(server.mappath(percorso & NomeFile1), True, False)
    textStream.Write ContenutoFile
    textStream.Close
    Set textStream = Nothing
    Set FSO = Nothing
    end if
    end if

    ' Lo stesso discorso vale anche per i campi dei file :
    ' Nel caso in cui fossero presenti piu file basta duplicare
    ' la condizione cambiando unicamente il nome del campo
    ' es.

    'if instr(Intestazione,"file2") > 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")
    ' Upload2 = True
    ' DimensioneFile2 = len(ContenutoFile)
    ' EstensioneFile2 = right(ContenutoFile,3)
    ' NomeFile2 = NomeFile
    ' Set textStream = FSO.CreateTextFile(server.mappath(percorso & NomeFile2), True, False)
    ' textStream.Write ContenutoFile
    ' textStream.Close
    ' Set textStream = Nothing
    ' Set FSO = Nothing
    ' end if
    'end if

    'if instr(Intestazione,"file3") > 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")
    ' Upload3 = True
    ' DimensioneFile3 = len(ContenutoFile)
    ' EstensioneFile3 = right(ContenutoFile,3)
    ' NomeFile3 = NomeFile
    ' Set textStream = FSO.CreateTextFile(server.mappath(percorso & NomeFile3), True, False)
    ' textStream.Write ContenutoFile
    ' textStream.Close
    ' Set textStream = Nothing
    ' Set FSO = Nothing
    ' end if
    'end if
    next

    ' Da qui in poi è possibile fare esegiure allo script altre operazioni
    ' inserire qui gli script aggiuntivi che si vogliono eseguire dopo l'upload
    ' Per esempio visualizzare quello che è stato inserito all'interno del
    ' compo testo

    Response.Write "Il valore immesso nella testo1 è " & fax & "
    "

    ' Utilizzando il sistema descritto sopra è possibile visualizzare campi
    ' testo aggiuntivi presenti nel form
    ' Response.Write "Il valore immesso nella testo2 è " & testo2 & "
    "
    ' Response.Write "Il valore immesso nella testo3 è " & testo3 & "
    "

    ' E la stessa cosa per i campi dove è stato eseguito l'upload dei file

    If Upload1 = true then
    Response.Write "
    La dimensione del file che hai uploadato è di " & DimensioneFile1*0.001 & "kb"
    "
    Grazie di aver inviato il tuo file"
    End If

    'If Upload2 = true then
    ' Response.Write "
    La dimensione del file che hai uploadato è di " & DimensioneFile2*0.001 & "kb"
    ' Response.Write "
    Grazie di aver inviato il tuo file"
    'End If

    'If Upload3 = true then
    ' Response.Write "
    La dimensione del file che hai uploadato è di " & DimensioneFile3*0.001 & "kb"
    ' Response.Write "
    Grazie di aver inviato il tuo file"
    'End If

    End if
    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Ce l'hai i permessi di scrittura nella root?

    Roby

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2007
    Messaggi
    66
    certo che si sto provando in locale!!!

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Originariamente inviato da styweb86
    certo che si sto provando in locale!!!
    E cosa c'entra? I permessi ce li hai se li metti, non sono di default.

    Roby

  5. #5
    Utente di HTML.it
    Registrato dal
    Jan 2007
    Messaggi
    66
    e come faccio ad impostarli!!!! utilizzo iis

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Li devi dare allo IUSR_NOMEMACCHINA.
    Cerca nel forum.

    Roby

  7. #7
    Utente di HTML.it
    Registrato dal
    Jan 2007
    Messaggi
    66
    non riesco a trovare nulla...mi daresti il link diretto!!??

  8. #8

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.