Pagina 1 di 4 1 2 3 ... ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 32

Discussione: informazione

  1. #1

    informazione

    salve a tutti.
    ho bisognoo di help.
    il mio problema e il seguente:

    ho un aplicativo asp, che carica un file.zip
    se carico in file nei ordini di grandezza= 2 Mbyt, va tutto ok.

    se invece carico un file intorno hai 5Mbyt, non funziona il caricamento.

    il timeout del web server e a 1500.

    qualcuno mi puo dare una mano?


    grazie.


  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Dipende se sei in hosting oppure no.
    Dipende se utilizzi componenti specifici per effettuare l'upload oppure no.

    Roby

  3. #3

    informazioni

    ti posso postare il codice?



    il server e in una intranet, da me gestito.


    grazie Roby_72 per il tuo aiuto!

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Cosa usi per l'upload?

    Roby

  5. #5
    Utente di HTML.it L'avatar di rinzi
    Registrato dal
    May 2004
    Messaggi
    1,444
    il problema è che superi il tempo massimo concesso ad uno script..
    ..ma si può cambiare...


    server.scripttimeout= secondi (che ne so 300 secondi...)

    mi sembra si chiami così la proprietà , o comunque una cosa simile..

    ...ah sempre che l'Amministratore lo permetta..

    prova...

    ciao

  6. #6

    informazioni!

    dato che non sono tanto pratico di programazione, il progetto e stato svillupato da un altra persona.
    ti posto il codice in due parti:

    1)
    <%@ Language=VBScript %>
    <%
    Response.buffer = true
    Response.CacheControl = "no-cache"
    Response.AddHeader "Pragma", "no-cache"
    Response.Expires = -1
    %>


    <%

    dim contentType, filepathname, pathCompletoFileDaScrivere, filename, filelength, extension, value
    dim Path_Fisico_Moduli,Path_Virtuale_Moduli,pathFisico Modulo,sNomeModulo,bTrovatoIndexHTM
    dim pathCompletoCartellaTemp,pathCompletoCartellaConte nuto, pathHTML,paginaHtmlDaLinkare
    dim idContenuto
    dim bAncheDomande

    Sub ImpostazioniPagina

    on error resume next

    sModulo = "ImpostazioniPagina"

    '
    sFunzione = "InsPagineNuovoModulo" 'Funzione gestita

    bPaginaVisibile = false 'indica se la pagina si trova nel frame visibile

    bUsaConnessione = true 'indica se la pagina gestisce una connessione al db

    if bUsaConnessione then
    bTransazionale = true 'indica se la pagina gestisce una transazione al db
    end if

    '

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit sub
    end if

    End Sub

    Function StartPgm

    on error resume next

    StartPgm = false

    Call ImpostazioniPagina

    sModulo="StartPgm"
    %>

    <%
    'imposto il flag admin a 1 per bloccare lo svolgimento dei corsi
    if not DB_SetAdminMode(1) then
    exit function
    end if
    %>
    <HTML>
    <HEAD>
    </HEAD>
    <%
    if bUsaConnessione _
    and bTransazionale then
    cnTransaction.BeginTrans
    bRollBack = false
    end if

    '

    '

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    StartPgm = true

    End Function

    Function MainPgm

    on error resume next

    MainPgm = false

    sModulo="MainPgm"

    Response.Clear

    dim byteCount,RequestBin

    'leggo il contenuto binario del form
    byteCount = Request.TotalBytes
    RequestBin = Request.BinaryRead(byteCount)

    Dim UplReq
    Set UplReq = CreateObject("Scripting.Dictionary")

    dim posFile,cntInputFile
    'carico il Dictionary tramite la procedura BuildUploadRequest
    call BuildUploadRequest (RequestBin,UplReq,cntInputFile)

    dim nameTxtFile,numPagina,bFile
    numPagina=0

    Path_Fisico_Moduli=Application("Path_Fisico_Moduli ")
    Path_Virtuale_Moduli=Application("Path_Virtuale_Mo duli")

    sNomeModulo=Session("Elearn_NomeModulo")
    bAncheDomande=Session("Elearn_AncheDomande")

    pathCompletoCartellaTemp=Path_Fisico_Moduli & "\" & sNomeModulo & "\Temp"
    'pathHTML=Application("Path_Virtuale_Moduli") & "/" & sNomeModulo & "/" &

    pathFisicoModulo= Path_Fisico_Moduli & "\" & sNomeModulo


    for i=0 to cntInputFile-1
    nameTxtFile="txtFile" & i
    contentType = UplReq.Item(nameTxtFile).Item("ContentType")
    filepathname = UplReq.Item(nameTxtFile).Item("FileName")
    value = UplReq.Item(nameTxtFile).Item("Value")
    filelength = LenB(value)
    filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
    extension = Right(filename,Len(filename)-InStrRev(filename,"."))

    'Controllo se si è tentato di fare l'inserimento di un file vuoto
    if Trim(filepathname)<>"" _
    and filelength=0 then
    myalert(Mess("xx06"))'Si è tentato di fare l'inserimento di un file vuoto nella posizione
    %>
    <SCRIPT LANGUAGE=javascript>
    <!--
    window.parent.frames.fraVisibile.frmUpload.<%=name TxtFile%>.select()
    window.parent.frames.fraVisibile.frmUpload.<%=name TxtFile%>.focus()

    //-->
    </SCRIPT>
    <%
    MainPgm = true
    exit function
    end if
    next

    dim PaginaCorr,rs
    PaginaCorr=0

    for i=0 to cntInputFile-1
    nameTxtFile="txtFile" & i
    contentType = UplReq.Item(nameTxtFile).Item("ContentType")
    filepathname = UplReq.Item(nameTxtFile).Item("FileName")
    value = UplReq.Item(nameTxtFile).Item("Value")
    filelength = LenB(value)
    filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
    extension = Right(filename,Len(filename)-InStrRev(filename,"."))

    'Se valorizzato l'input file allora vado a salvare il .zip in una directory temporanea
    if Trim(filepathname)<>"" then

    pathCompletoFileDaScrivere= pathCompletoCartellaTemp & "\" & filename

    if not SalvaFileInTemp(value,filename) then
    exit function
    end if

    if UCase(extension)="ZIP" then
    if not GestioneUnzipFile(value,filename,i) then
    exit function
    end if
    else
    paginaHtmlDaLinkare=filename
    end if

    'incremento il numero di pagina
    PaginaCorr=PaginaCorr+1

    'set rs=nothing
    'set rs = Server.CreateObject("ADODB.Recordset")

    'inserisco(col campo HTML a blank) ed ottengo l'idContenuto
    dim ident
    if not DB_InsertContenuto(ident,PaginaCorr) then
    exit function
    end if

    idContenuto=ident

    set rs=nothing

    'Modifico il campo HTML col path ricavato
    if not DB_UpdateContenuto then
    exit function
    end if

    'rinomino la cartella temp con l'id contenuto
    'pathCompletoCartellaContenuto=Path_Fisico_Moduli & "\" & sNomeModulo & "\" & idContenuto
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFolder(pathCompletoCartellaTemp)

    f.name=idContenuto

    Response.Write "dopo" & err.number
    Response.Write "
    "
    set f=nothing
    set fso=nothing

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if
    end if
    next

    set rs=nothing
    set rs = Server.CreateObject("ADODB.Recordset")

    'inserisco(col campo HTML a blank) ed ottengo l'idContenuto

    if not DB_UpdateTotPagine(PaginaCorr) then
    exit function
    end if

    myalert Mess("xx09")'Caricamento pagine effettuato con successo
    %>
    <SCRIPT LANGUAGE=javascript>
    <!--
    <% if bAncheDomande then %>
    window.parent.frames.fraVisibile.location.replace( "GestioneDomande.asp?IdModulo=<%=Session("Elearn_i dModulo")%>")
    <% else %>
    window.parent.frames.fraVisibile.location.replace( "NuovoModulo.asp")
    <% end if %>
    //-->
    </SCRIPT>

    <%
    Set UplReq = nothing

    '
    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    MainPgm = true

    End Function

    Function EndPgm

    on error resume next

    EndPgm = false

    sModulo = "EndPgm"

    if not bPaginaVisibile then
    %> <script language="JavaScript">
    <!--
    window.location.replace("about:blank")
    //-->
    </script>
    <%
    end if

    if bUsaConnessione then
    if bTransazionale then
    cnTransaction.CommitTrans 'confermo modifiche al DB
    end if
    Set cn=Nothing
    Set cnTransaction=Nothing
    end if

    %> </body>
    </html>
    <%
    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    EndPgm = true

    End Function

    '---- custom start -----
    Function GestioneUnzipFile(ByRef value, ByRef filename, ByVal corrInputFile)

    on error resume next

    GestioneUnzipFile = false

    sModulo = "GestioneUnzipFile"

    if not Unzip(value,filename) then
    exit function
    end if

    if not CtlPresenzaPaginaHTML(corrInputFile) then
    exit function
    end if

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    GestioneUnzipFile = true

    End Function

    Function SalvaFileInTemp(ByRef value, ByRef filename)

    on error resume next

    SalvaFileInTemp = false

    sModulo = "SalvaFileInTemp"

    'Create FileSytemObject Component

    dim MyFile,ScriptObject,MyTempFolder

    Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    'creo la cartella dei moduli se non esiste
    set MyTempFolder = ScriptObject.CreateFolder(Path_Fisico_Moduli)

    If err.number <> 0 then
    if err.number = 58 then
    err.number=0'ignoro l'errore di cartella già esistente
    end if
    end if
    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    'creo la cartella Temp sotto la cartella del modulo corrente se non esiste
    set MyTempFolder = ScriptObject.CreateFolder(pathCompletoCartellaTemp )

    If err.number <> 0 then
    if err.number = 58 then
    err.number=0'ignoro l'errore di cartella già esistente
    end if
    end if
    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    'vuoto la cartella temp
    ScriptObject.DeleteFile(pathCompletoCartellaTemp & "\*.*")

    If err.number <> 0 then
    if err.number = 58 then
    err.number=0'ignoro l'errore di cartella già esistente
    end if
    end if
    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    'scrivo il file zip nella cartella temp

  7. #7
    oppure è il set di mb massimo che supporta il componente che usi per l'upload ... modificabile di sicuro ...
    se non è bello ciò che è bello figuriamoci ciò che è brutto!!



    fai anche tu come me: indenta il codice!!!!

  8. #8

    informazioni!

    2)

    Set MyFile = ScriptObject.CreateTextFile(pathCompletoFileDaScri vere)

    For i = 1 to LenB(value)
    MyFile.Write chr(AscB(MidB(value,i,1)))
    Next

    Set ScriptObject = nothing
    set MyTempFolder =nothing
    set MyFile=nothing

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    SalvaFileInTemp = true

    End Function

    Function Unzip(ByRef value, ByRef filename)

    on error resume next

    Unzip = false

    sModulo = "Unzip"

    dim objUnzip
    set objUnzip=Server.CreateObject("prjUnzip.cUnzip")

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    pathCompletoFileDaZippare= pathCompletoCartellaTemp & "\" & filename

    objUnzip.DoUnzip pathCompletoFileDaZippare,pathCompletoCartellaTemp

    err.number=objUnzip.Retcode

    set objUnzip=nothing

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    Unzip = true

    End Function

    Function CtlPresenzaPaginaHTML(ByVal corrInputFile)

    on error resume next

    CtlPresenzaPaginaHTML = false

    sModulo = "CtlPresenzaPaginaHTML"

    'Create FileSytemObject Component

    dim MyFile,ScriptObject

    Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")

    Set f = ScriptObject.GetFolder(pathCompletoCartellaTemp)
    Set fc = f.Files

    dim cntFileHTM,ext,bTrovatoIndexHTM,sNomePaginaHTML
    cntFileHTM=0

    bTrovatoIndexHTM=""
    sNomePaginaHTML=""
    For Each f1 in fc
    if UCase(f1.name) = "INDEX.HTM" _
    OR UCase(f1.name) = "INDEX.HTML" then
    bTrovatoIndexHTM=f1.name
    end if
    ext=Ucase(Right(f1.name,Len(f1.name)-InStrRev(f1.name,".")))
    if ext="HTM" or ext="HTML" then
    cntFileHTM=cntFileHTM+1
    sNomePaginaHTML = f1.name
    end if
    Next

    nameTxtFile="txtFile" & corrInputFile

    if cntFileHTM=0 then
    myalert(Mess("xx07"))'Rilevato un file zip contenente nessuno nella posizione
    %>
    <SCRIPT LANGUAGE=javascript>
    <!--
    window.parent.frames.fraVisibile.frmUpload.<%=name TxtFile%>.select()
    window.parent.frames.fraVisibile.frmUpload.<%=name TxtFile%>.focus()
    //-->
    </SCRIPT>
    <%
    exit function
    end if

    if cntFileHTM>1 then
    if bTrovatoIndexHTM="" then
    myalert(Mess("xx08"))'Rilevato un file zip contenente più di un file HTML ma nessuno con nome Index.htm, nella posizione
    %>
    <SCRIPT LANGUAGE=javascript>
    <!--
    window.parent.frames.fraVisibile.frmUpload.<%=name TxtFile%>.select()
    window.parent.frames.fraVisibile.frmUpload.<%=name TxtFile%>.focus()
    //-->
    </SCRIPT>
    <%
    exit function
    end if
    end if

    if bTrovatoIndexHTM="" then
    paginaHtmlDaLinkare=sNomePaginaHTML
    else
    paginaHtmlDaLinkare=bTrovatoIndexHTM
    end if

    Set ScriptObject = nothing
    Set f = nothing
    Set fc = nothing

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    CtlPresenzaPaginaHTML = true

    End Function

    Function DB_InsertContenuto(ByRef identita, Byval PaginaCorr)

    on error resume next

    DB_InsertContenuto = false

    sModulo = "DB_InsertContenuto"

    dim parameter

    Set cmd = Server.CreateObject("ADODB.Command")
    set parameter = Server.CreateObject("ADODB.Parameter")

    if not ImpostaSP(cmd,cnTransaction,"spInsertContenuto") then
    exit function
    end if

    Set parameter = cmd.CreateParameter("idModulo", adInteger, adParamInput, 4, Session("Elearn_idModulo"))
    cmd.Parameters.Append (parameter)

    Set parameter = cmd.CreateParameter("NrPagina", adInteger, adParamInput, 4, PaginaCorr)
    cmd.Parameters.Append (parameter)

    pathHTML=""
    Set parameter = cmd.CreateParameter("HTML", adVarchar, adParamInput, 4096, pathHTML)
    cmd.Parameters.Append (parameter)

    Set parameter = cmd.CreateParameter("identita", adInteger, adParamOutput, 4, identita)
    cmd.Parameters.Append (parameter)

    cmd.execute

    identita=cmd.parameters("identita").value

    set cmd=nothing
    set parameter=nothing

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    DB_InsertContenuto = true

    End Function

    Function DB_UpdateContenuto

    on error resume next

    DB_UpdateContenuto = false

    sModulo = "DB_UpdateContenuto"

    dim parameter

    Set cmd = Server.CreateObject("ADODB.Command")
    set parameter = Server.CreateObject("ADODB.Parameter")

    if not ImpostaSP(cmd,cnTransaction,"spUpdateContenuto") then
    exit function
    end if

    Set parameter = cmd.CreateParameter("idContenuto", adInteger, adParamInput, 4, idContenuto)
    cmd.Parameters.Append (parameter)

    pathHTML=idContenuto & "/" & paginaHtmlDaLinkare
    Set parameter = cmd.CreateParameter("HTML", adVarchar, adParamInput, 4096, pathHTML)
    cmd.Parameters.Append (parameter)

    cmd.execute

    set cmd=nothing
    set parameter=nothing

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    DB_UpdateContenuto = true

    End Function

    Function DB_UpdateTotPagine(ByVal NumPagineTotali)

    on error resume next

    DB_UpdateTotPagine = false

    sModulo = "DB_UpdateTotPagine"

    dim parameter

    Set cmd = Server.CreateObject("ADODB.Command")
    set parameter = Server.CreateObject("ADODB.Parameter")

    if not ImpostaSP(cmd,cnTransaction,"spUpdateNumPagineModu lo") then
    exit function
    end if

    Set parameter = cmd.CreateParameter("idModulo", adInteger, adParamInput, 4, Session("Elearn_idModulo"))
    cmd.Parameters.Append (parameter)

    Set parameter = cmd.CreateParameter("NumPagine", adInteger, adParamInput, 4, NumPagineTotali)
    cmd.Parameters.Append (parameter)

    cmd.execute

    set cmd=nothing
    set parameter=nothing

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    DB_UpdateTotPagine = true

    End Function

    Function DB_SetAdminMode(ByVal AdminMode)

    on error resume next

    DB_SetAdminMode = false

    sModulo = "DB_SetAdminMode"

    dim parameter

    Set cmd = Server.CreateObject("ADODB.Command")
    set parameter = Server.CreateObject("ADODB.Parameter")

    if not ImpostaSP(cmd,cn,"spUpdateAdminMode") then
    exit function
    end if

    Set parameter = cmd.CreateParameter("AdminMode", adInteger, adParamInput, 1, AdminMode)
    cmd.Parameters.Append (parameter)

    cmd.execute

    set cmd=nothing
    set parameter=nothing

    If err.number <> 0 then
    call GestioneErrore(sModulo)
    exit function
    end if

    DB_SetAdminMode = true

    End Function
    %>

  9. #9
    Utente di HTML.it L'avatar di rinzi
    Registrato dal
    May 2004
    Messaggi
    1,444
    leggio il mio post precedente -...è quello il motivo


    l'ho già fatto in passato

  10. #10

    informazioni!

    ciao rinzi.
    server.scripttimeout= secondi (che ne so 300 secondi...)
    dove si trova?, nel senso e una impostazione di cosa?
    grazie.

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.