---
title: "Sablar, aspsmartupload vill krångla"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/11934-sablar-aspsmartupload-vill-krångla"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "His Divine Shadow"
published: "2001-10-03T11:15:00.000Z"
updated: "2001-10-04T05:26:00.000Z"
replies: 1
views: 239
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/11934-sablar-aspsmartupload-vill-krångla"
---

# Sablar, aspsmartupload vill krångla

## #1 — His Divine Shadow, 2001-10-03T11:15Z

aspSmartUpload.Files error '800404b5' 

Invalid Files Name '' (Error 1205) 

/katalog/swe/produkt_redigera2.asp, line 48 

Koden:

```
<%
'  Variables
'  *********
   Dim mySmartUpload
 '  Dim intCount
        
'  Object creation
'  ***************
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

'  Upload
'  ******
set skapamapp = mySmartUpload.Form("Username")

'  Save the files with their original names in a virtual path of the web server
'  ****************************************************************************
   intCount = mySmartUpload.Save("/Katalog/Images/" & skapamapp)
   ' sample with a physical path 
   ' intCount = mySmartUpload.Save("c:\temp\")
%>

<%
'Declare all local variables

dim conn
dim rs
dim strID
dim strconn

'set a local variable to my DSN-less connection String
strconn = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\data\WebData\katalog.mdb;"

'Create the Connection object 
set conn = server.createobject("adodb.connection")
conn.open strconn

'Create the recordset object
set rs = server.createobject("adodb.recordset")
'This statement opens the table so we can add a record notice the addnew 
'The 2, 2 is how the table is opened there are many ways it can be opened
rs.open "Kat", conn, 2, 2, adCmdTable

rs.update
'Set the table column = to my input text box from my form
linje 48 -> rs("produktbild") = mySmartUpload.Files.Item(1).FileName
rs("produkt_namn_swe") = mySmartUpload.Form("produkt_namn_swe") 
rs("produkt_namn_fin") = mySmartUpload.Form("produkt_namn_fin") 
rs("pris") = mySmartUpload.Form("pris")
rs("Layout") = mySmartUpload.Form("Layout")
rs("produkt_info_swe") = mySmartUpload.Form("produkt_info_swe")
rs("produkt_info_fin") = mySmartUpload.Form("produkt_info_fin")
rs.update
'I do a movelast here to get the ID that is automatically generated 
'I also set the value to a local variable so I can write out to the database

%>
```

Permalänk: https://www.webforum.nu/p/11934

## #2 — martinpartin, 2001-10-04T05:26Z

Hej,

jag andvänder denna kod som är en aning slarvig men du kanske kan hitta nått. Den fungerar iaf.
\---------------------

\<%
Dim Connect, RS, Addstmt, SQLMAX, MaxFileName, filenamex, item, value

Set Connect = Server.CreateObject("ADODB.Connection")

Connect.Open "driver={Microsoft Access Driver (\*.mdb)};dbq="& dbpath &""

Set RS = Server.CreateObject("ADODB.Recordset")
SQLMAX = "SELECT \* FROM table01 WHERE unifilename = (SELECT MAX(unifilename) FROM table01)"
RS.Open SQLMAX, Connect, adOpenStatic, adLockOptimistic

If RS.EOF AND RS.BOF THEN
MaxFileName = 1
Response.write("EOF AND BOF")
Else
MaxFileName = RS("unifilename") + 1
Response.write("found ...\<BR\>")
End If
RS.Close 

'  Variables
'  \*\*\*\*\*\*\*\*\*
   Dim mySmartUpload
   Dim intCount
        
'  Object creation
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
'  Only allow PDF files
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   mySmartUpload.AllowedFilesList = "pdf"

   

'  Upload
'  \*\*\*\*\*\*
   mySmartUpload.Upload

'  Save the files with their original names in a virtual path of the web server
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   
   intCount = mySmartUpload.Save("D:\\inetpub\\wwwroot\\crs\\salesreports\\movingdir")
   ' sample with a physical path 
   ' intCount = mySmartUpload.Save("/someshit")

'  Display the number of files uploaded
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Response.Write(intCount & " file(s) uploaded.")
'  Informations about files
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Response.Write("Number of files =" & mySmartUpload.Files.count &"\<BR\>")
   Response.Write("Total bytes of files =" & mySmartUpload.Files.TotalBytes &"\<BR\>")
'  Select each file
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   For each file In mySmartUpload.Files
      Response.Write(file.FileName & " (" & file.Size & "bytes)\<BR\>")
      filenamex = file.filename
   Next

'  FORM Collection
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Set RS = Server.CreateObject("ADODB.Recordset")
   Addstmt = "SELECT \* FROM table01" 
   RS.Open Addstmt, Connect, adOpenStatic, adLockOptimistic
   RS.AddNew
   RS("unifilename") = MaxFileName
   RS("MyDate") = Date 
'  Select each item
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   For each item In mySmartUpload.Form
   '  Select each value of the current item
   '  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
      For each value In mySmartUpload.Form(item)
         RS("" & item & "") = value
      Next
   Next
RS.Update
   RS.Close 

Connect.Close

Dim fso, file
Set fso = CreateObject("Scripting.FileSystemObject")

Set file = fso.GetFile("D:\\inetpub\\wwwroot\\crs\\salesreports\\movingdir\\"& filenamex &"")

file.Move ("D:\\inetpub\\wwwroot\\crs\\salesreports\\database\\img\\"& MaxFileName &".pdf")

%\>
\<% = MaxFileName %\>

//Martin

Permalänk: https://www.webforum.nu/p/288055

---

Tråden på webben: https://www.webforum.nu/amne/asp/11934-sablar-aspsmartupload-vill-krångla
