• Super User

    Non saprei, dovrei vedere il codice della pagina. Dove lo hai preso lo script?


  • User

    questo è lo script di upload del file :

    *** Pure ASP File Upload 2.1.4
    Dim GP_uploadAction,UploadQueryString
    PureUploadSetup
    If (CStr(Request.QueryString("GP_upload")) <> "") Then
      Dim pau_thePath,pau_Extensions,pau_Form,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout,pau_progressBar,pau_progressWidth,pau_progressHeight
      pau_thePath = """/public/Download"""
      pau_Extensions = ""
      pau_Form = "inserisci"
      pau_Redirect = ""
      pau_storeType = "file"
      pau_sizeLimit = ""
      pau_nameConflict = "error"
      pau_requireUpload = "true"
      pau_minWidth = ""
      pau_minHeight = "" 
      pau_maxWidth = ""
      pau_maxHeight = ""
      pau_saveWidth = ""
      pau_saveHeight = ""
      pau_timeout = "600"
      pau_progressBar = "fileCopyProgress.htm"
      pau_progressWidth = "300"
      pau_progressHeight = "100"
      
      Dim RequestBin, UploadRequest
      CheckPureUploadVersion 2.14
      ProcessUpload pau_thePath,pau_Extensions,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout
    end if
    

    e questa è la form che inserisce i dati nel db:

    <form ACTION="<%=MM_editAction%>" METHOD="POST" enctype="multipart/form-data" name="inserisci" id="inserisci" onSubmit="checkFileUpload(this,'',true,'','','','','','','');showProgressWindow('fileCopyProgress.htm',300,100);return document.MM_returnValue">
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <table width="560" border="0" align="center" bgcolor="#FFB709">
            <tr>
              <td width="160" class="menu-titolo">Nome file </td>
              <td colspan="5"><input name="NomeFile" type="file" id="NomeFile" onChange="checkOneFileUpload(this,'',true,'','','','','','','')"></td>
            </tr>
            <tr>
              <td class="menu-titolo">Descrizione </td>
              <td colspan="5" class="menu-titolo"><textarea name="commento" cols="50" id="commento"></textarea></td>
            </tr>
            <tr>
              <td class="menu-titolo">Tipo file </td>
              <td width="68" class="menu-titolo"><select name="tipoFile" id="tipoFile">
                <option value="zip">zip</option>
                <option value="pdf">pdf </option>
              </select></td>
              <td width="89" class="menu-titolo">Categoria</td>
              <td width="54" class="menu-titolo"><select name="categoria" id="categoria">
                <option value="documenti">documenti</option>
                <option value="tecniche scout">tecniche scout</option>
              </select></td>
              <td width="85" class="menu-titolo Stile1">Riservato</td>
              <td width="78" class="menu-titolo Stile1"><select name="riservato" id="riservato">
                <option value="si">si</option>
                <option value="no">no</option>
              </select></td>
            </tr>
            <tr>
              <td height="26">
                <div align="center" class="menu-titolo">
                  <div align="left">data file 
                  </div>
                </div></td>
              <td height="26"><input name="data" type="text" id="data"></td>
              <td height="26">Autore</td>
              <td height="26"><input name="autore" type="text" id="autore"></td>
              <td height="26">&nbsp;</td>
              <td height="26">&nbsp;</td>
            </tr>
            <tr>
              <td height="26" colspan="6"><div align="center">
                <input type="submit" name="Submit" value="Iserisci Documento In Archivio">
              </div></td>
            </tr>
          </table>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
    
                <input type="hidden" name="MM_insert" value="inserisci">
        </form>
    

  • Super User

    Se fai Request.TotalBytes ottieni qualcosa?


  • User

    dove lo inserisco ?
    perdonami ma non sono espertissimo :crying:


  • Super User

    In che pagina hai inserito lo script?


  • User

    .roma122.it/areadownload/update1.asp


  • Super User

    Se lo inserisci in quella? Però una domanda: conosci asp?


  • User

    non benissimo
    se trovo il codice scritto riesco a modificare e a scrivere alcune funzioni la magior parte le creo con dreamweaver


  • User

    cambio idea per arrivare allo stesso risultato questo credo sia più semplice e più preciso :

    con questa funzione leggo le dimensioni del file presente sul server :

    <%
    'dimensione file 
    Function GetFileSize(filepath)
      Dim fso, f
      Set fso = Server.CreateObject("Scripting.FileSystemObject")
      Set f = fso.GetFile(filepath)
      Response.Write("La dimensione del file è: ")
      Response.Write(FormatNumber(f.Size/1024, 2)&" Kb")
      Set f = nothing
      Set fso = nothing
    End Function
    
    Dim fname, fpath
    fname = "/public/download/q.txt"  'nome del file da controllare
    fpath = Server.MapPath(fname)
    GetFileSize(fpath)
    'fine 
    %>
    
    ```il problema è che in questo caso devo inserire il percorso e il nome del file 
    
    

    fname = "/public/download/q.txt"

    
    

    <%
    While ((Repeat1__numRows <> 0) AND (NOT Estrai.EOF))
    %>
    <tr>
    <th scope="row"><a href="public/download<%=Estrai.Fields.Item("NomeFile").Value%>"><%=(Estrai.Fields.Item("NomeFile").Value)%></a></th>
    <td><%=(Estrai.Fields.Item("DataFile").Value)%></th>
    <td><%=(Estrai.Fields.Item("Data").Value)%></td>
    <td><%=(Estrai.Fields.Item("Categoria").Value)%></td>
    <td><%=(Estrai.Fields.Item("Autore").Value)%>
    </tr>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    Estrai.MoveNext()
    Wend
    %>

    tipo questo che mi crea il link al file sul server nella tabella sopra riportata :
    
    

    href="public/download<%=Estrai.Fields.Item("NomeFile").Value%>"><%=(Estrai.Fields.Item("NomeFile").Value)%></a></th>


  • Super User

    Il percorso del file è
    public/download<%=Estrai.Fields.Item("NomeFile").Value%>


  • User

    Microsoft VBScript compilation error '800a03ea'
    Syntax error
    /AreaDownload/sommario.asp, line 58
    Function GetFileSize(filepath)

    ^

    lo ho modificato in questo modo ma mi da errore

    'dimensione file 
    Function GetFileSize(filepath)
      Dim fso, f
      Set fso = Server.CreateObject("Scripting.FileSystemObject")
      Set f = fso.GetFile(filepath)
      Response.Write("La dimensione del file è: ")
      Response.Write(FormatNumber(f.Size/1024, 2)&" Kb")
      Set f = nothing
      Set fso = nothing
    End Function
    
    Dim fname, fpath
    fname = "public/download<%=Estrai.Fields.Item("NomeFile").Value%>"  
    fpath = Server.MapPath(fname)
    GetFileSize(fpath)
    'fine 
    

    riga 58

    Function GetFileSize(filepath)
    
    

  • User

    mi avete abandonato ?????????

    help !


  • Super User

    Mi spiace ma non sono così esperto di ASP. in ogni caso che errore da?


  • User

    è sul post sopra

    grazie


  • Super User

    Non so a cosa potrebbe essere dovuto, forse a qualche riga precedente?


  • User

    non credo perchè se io quì

    fname = "public/download<%=Estrai.Fields.Item("NomeFile").Value%>" 
    

    il percorso diretto mi da la dimensione di quel file


  • Super User

    Se visualizzi fname cosa restituisce?


  • User

    mi dà l'errore .
    se gli metto il percorso singolo mi restituisce

    /public/download/q.txt
    

    ti spiego se inserisco il codice fuori della tabella con la queri funziona

    roma122.it/AreaDownload/sommario.asp

    quarga ora

    se lo metto nella posizione affianco al file mi da l'errore di prima

    icrosoft VBScript compilation error '800a0411' Name redefined
    /AreaDownload/sommario.asp, line 75
    Dim fname, fpath
    ----^

    hai msn si fa prima ?


  • Super User

    ma Estrai.Fields.Item("NomeFile") è valorizzato? sei sicuro che sia giusto prenderlo così?


  • User

    No infatti......

    il problema è che non so come rendere dinamica quello script