---
title: "Konvertera till aspSmartUpload"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/137380-konvertera-till-aspsmartupload"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "WebbisNet"
published: "2005-11-10T17:23:40.000Z"
updated: "2005-11-17T10:30:08.000Z"
replies: 35
views: 1102
page: 1
pages: 2
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/137380-konvertera-till-aspsmartupload"
---

# Konvertera till aspSmartUpload

_Sida 1 av 2._

## #1 — WebbisNet, 2005-11-10T17:23Z

Nån som vet hur kan konverterar detta till aspSmartUpload och enbart tillåta gif,jpg,png och mp3

```
<%
Set Upload = Server.CreateObject("Persits.Upload")
Upload.OverwriteFiles = False
Upload.SetMaxSize 100000, False
Count=Upload.Save(Server.MapPath("/images/gallery"))
For Each file In Upload.Files
  If File.ImageType = "UNKNOWN" Then
  
      Response.Redirect "/pictureupload/gallery/?error=filetype"
      File.Delete 
   End If
  Next
For Each file In Upload.Files

If file.Size = 100000 Then

        Response.Redirect "/pictureupload/gallery/?error=fileTooBig"
    File.Delete 
    End If
Next

Set File = Upload.Files

rubrik = replace(Upload.form("txtRubrik"),"'","''")
kommentar = replace(Upload.form("txtKommentar"),"'","''")

If NOT File Is Nothing Then
On Error Resume Next
strFileName= Upload.Files("blob").ExtractFileName  

END IF
   

Dim objConn
varTillhor=Session("userID")
upplagd = Now()
storlek=file.size
	SET objConn = connect()
	picture = "INSERT INTO tblUsers_Galleri"
	picture = picture & "(bild,agare,inlagd,rubrik,kommentar) "
	picture = picture & "VALUES('" & strFileName & "','"& varTillhor &"','"& upplagd&"','"& rubrik &"','"& kommentar &"')"
	objConn.Execute picture
objConn.Execute("Update tblUsers SET poang = poang+0.8 WHERE userID= " & UserID &"")
	%>

<%response.redirect "/pictureupload/gallery/?filename=" & strFileName & "&pic=" & strFileName & "&message=pic"%>
```

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

## #2 — @nders, 2005-11-10T17:28Z

<http://www.aspsmart.com/aspSmartUpload/liblocal/docs/Objects.htm>

Försök först själv.

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

## #3 — WebbisNet, 2005-11-10T19:57Z

Hur tar man emot filen för att ladda upp den

```
<form action="/test.asp?do=upload" method="post">
<input type="file" name="file">
<input type="submit">
</form>

<%if request("do") = "upload" then
   On Error Resume Next

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

'  Only allow txt or htm files
'  ***************************
   mySmartUpload.AllowedFilesList = "htm,txt"

'  DeniedFilesList can also be used :
   ' Allow all files except exe, bat and asp
   ' ***************************************
   ' mySmartUpload.DeniedFilesList = "exe,bat,asp"

'  Deny physical path
'  *******************
   mySmartUpload.DenyPhysicalPath = True

'  Only allow files smaller than 50000 bytes
'  *****************************************
   mySmartUpload.MaxFileSize = 50000

'  Deny upload if the total fila size is greater than 200000 bytes
'  ***************************************************************
   mySmartUpload.TotalMaxFileSize = 200000

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

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

'  Trap errors
'  ***********
   If Err Then
      Response.Write("<b>Wrong selection : </b>" & Err.description)
   Else
   '  Display the number of files uploaded
   '  ************************************
      Response.Write(intCount & " file(s) uploaded.")
   End If
end if%>
```

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

## #4 — WebbisNet, 2005-11-10T20:04Z

Hur tar man emot filen för att ladda upp den

```
<form action="/test.asp?do=upload" method="post">
<input type="file" name="file">
<input type="submit">
</form>

<%if request("do") = "upload" then
   On Error Resume Next

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

'  Only allow txt or htm files
'  ***************************
   mySmartUpload.AllowedFilesList = "htm,txt"

'  DeniedFilesList can also be used :
   ' Allow all files except exe, bat and asp
   ' ***************************************
   ' mySmartUpload.DeniedFilesList = "exe,bat,asp"

'  Deny physical path
'  *******************
   mySmartUpload.DenyPhysicalPath = True

'  Only allow files smaller than 50000 bytes
'  *****************************************
   mySmartUpload.MaxFileSize = 50000

'  Deny upload if the total fila size is greater than 200000 bytes
'  ***************************************************************
   mySmartUpload.TotalMaxFileSize = 200000

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

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

'  Trap errors
'  ***********
   If Err Then
      Response.Write("<b>Wrong selection : </b>" & Err.description)
   Else
   '  Display the number of files uploaded
   '  ************************************
      Response.Write(intCount & " file(s) uploaded.")
   End If
end if%>
```

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

## #5 — @nders, 2005-11-10T20:34Z

.Upload
.Save

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

## #6 — WebbisNet, 2005-11-10T20:55Z

Får bara object required :-)

```
<form action="/test.asp?do=upload&test=yes" method="post" ENCTYPE="multipart/form-data" >
<input type="file" name="file">
<input type="submit">
</form>

<%if request("do") = "upload" then
   On Error Resume Next

'  Variables
'  *********
   Dim mySmartUpload
   Dim intCount
        
'  Object creation
'  ***************
Request.QueryString("test")

   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

mySmartUpload.Files("file")

'  Only allow txt or htm files
'  ***************************
   mySmartUpload.AllowedFilesList = "htm,txt"

'  DeniedFilesList can also be used :
   ' Allow all files except exe, bat and asp
   ' ***************************************
   ' mySmartUpload.DeniedFilesList = "exe,bat,asp"

'  Deny physical path
'  *******************
   mySmartUpload.DenyPhysicalPath = True

'  Only allow files smaller than 50000 bytes
'  *****************************************
   mySmartUpload.MaxFileSize = 50000

'  Deny upload if the total fila size is greater than 200000 bytes
'  ***************************************************************
   mySmartUpload.TotalMaxFileSize = 200000

'  Upload
'  ******
   mySmartUpload.Upload
mySmartUpload.Files("test")

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

'  Trap errors
'  ***********
   If Err Then
      Response.Write("<b>Wrong selection : </b>" & Err.description)
   Else
   '  Display the number of files uploaded
   '  ************************************
      Response.Write(intCount & " file(s) uploaded.")
   End If
end if%>
```

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

## #7 — emission, 2005-11-10T21:09Z

Raderna med 

mySmartUpload.Files("file")

och 

mySmartUpload.Files("test")

borde orsaka fel, och har ingen funktion. Här är ett annat bra exempel att titta på:

<http://www.aspsmart.com/scripts/aspSmartUpload/publigen/content/templates/show.asp?P=353&L=EN>

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

## #8 — WebbisNet, 2005-11-10T21:39Z

jag får 
Server object error 'ASP 0177 : 800401f3' 

Server.CreateObject Failed 

/test.asp, line 39 

800401f3 

och det är på raden
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

> **emission skrev:**
>
> Raderna med 
> 
> mySmartUpload.Files("file")
> 
> och 
> 
> mySmartUpload.Files("test")
> 
> 
> borde orsaka fel, och har ingen funktion. Här är ett annat bra exempel att titta på:
> 
> <http://www.aspsmart.com/scripts/aspSmartUpload/publigen/content/templates/show.asp?P=353&L=EN>

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

## #9 — @nders, 2005-11-11T04:03Z

Är komponenten installerad på servern då?

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

## #10 — WebbisNet, 2005-11-11T04:32Z

ja det ska den vara enligt deras sida

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

## #11 — @nders, 2005-11-11T06:54Z

Vad är det för webhotell då?

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

## #12 — Eclipse, 2005-11-11T10:36Z

1\. Det finns två komponenter med nästan samma namn. ASP Smart Upload och ASP Upload tror jag dom heter, och är inte samma sak.

2\. Enklaste sättet att ta bort en fil är med FSO: (Fungerar oberoende av komponent)

```
myVar = request("delete")
IF myVar <> "" THEN

	SQL = "SELECT intID, strFileName FROM [" & myTable & "] WHERE intID = " & myVar & ""
	set mySQL = Conn.Execute(SQL)

	' ## DELETE FILE
	Set fso = Server.CreateObject("Scripting.FileSystemObject")
	IF fso.fileExists( server.MapPath("\images\" & mySQL(1) ) ) THEN
		fso.DeleteFile(Server.MapPath("\images\") & "\" & mySQL(1))
	END IF
	IF fso.fileExists( server.MapPath("\images\low_" & mySQL(1) ) ) THEN
		fso.DeleteFile(Server.MapPath("\images\") & "\low_" & mySQL(1))
	END IF
	IF fso.fileExists( server.MapPath("\images\mid_" & mySQL(1) ) ) THEN
		fso.DeleteFile(Server.MapPath("\images\") & "\mid_" & mySQL(1))
	END IF
	IF fso.fileExists( server.MapPath("\images\high_" & mySQL(1) ) ) THEN
		fso.DeleteFile(Server.MapPath("\images\") & "\high_" & mySQL(1))
	END IF
	Set fso = Nothing
END IF
```

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

## #13 — WebbisNet, 2005-11-11T11:52Z

<http://www.axentus.se/w-smartsuite.asp>

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

## #14 — Eclipse, 2005-11-11T12:06Z

Oj! Det var ju heltäckande...!

Jag undrar om det inte är ASPJpeg du ska välja.

Jag vet att en av de andra komponenterna komprimerade bilder på ett mycket dåligt sätt. Minns ej om det var ASPUpload eller ASPSmarUpload!! Men ska ta reda på det...

\*kollar\*

Nej, jag kör ASPSmarUpload och då är det ASPUpload du helst inte ska använda. Jag har kört ASPJpeg till vissa kunder...

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

## #15 — WebbisNet, 2005-11-11T12:14Z

Får jag bara till koden för aspSmartUpload så använder jag den, och vill hellre ha denna komponent eftersom jag vill kunna skicka upp mp3, wav och zip-filer förutom bildformaten istället för aspJpeg

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

## #16 — emission, 2005-11-11T17:52Z

Skumt. Det råkar inte vara så att du utvecklar lokalt?

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

## #17 — WebbisNet, 2005-11-14T18:29Z

Utvecklar direkt på servern

Nu får jag aspSmartUpload.File error '80040460'

Unable to save file (Error 1120)

/test.asp, line 53 

mappen finns men den kan inte spara

rad 53 är  file.SaveAs("/images/" & file.FileName)

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

## #18 — WebbisNet, 2005-11-15T21:13Z

varför får jag detta fel
aspSmartUpload.File error '80040460' 

Unable to save file (Error 1120) 

/test.asp, line 69 

rad 69 är den fetmarkerade raden

```
<form action="?do=upload" method="post" ENCTYPE="multipart/form-data" ID="Form1">
<input type="file" name="txtFile" ID="File1">
<input type="submit" name="Submit1" ID="Submit1">
</form>

<%Select Case request.QueryString("do") 
    Case "upload"

'  Variables
'  *********
   Dim mySmartUpload
   Dim file

'  Object creation
'  ***************
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

'  Only allow some files
'  ***************************
   mySmartUpload.AllowedFilesList = "htm,txt,gif,png,mp3"

'  Deny physical path
'  *******************
   mySmartUpload.DenyPhysicalPath = True

'  Only allow files smaller than 50000 bytes
'  *****************************************
   mySmartUpload.MaxFileSize = 50000

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

'  Select file
'  ****************
   Set file = mySmartUpload.Files("txtFile") 
   
'  Only if the file exist
'  **********************
    If file.IsMissing Then
        Response.Write("Filen saknas!<BR>")        
    Else
    '  Save the files with his original names in a virtual path of the web server
    '  **************************************************************************
        strFil = file.FileName
        [B]file.SaveAs("/images/" & strFil)[/B]
        ' sample with a physical path
        ' file.SaveAs("c:\temp\" & strFil)

    '  Display the properties of the current file
    '  ******************************************
        Response.Write("Name = " & file.Name & "<BR>")
        Response.Write("Size = " & file.Size & "<BR>")
        Response.Write("FileName = " & file.FileName & "<BR>")
        Response.Write("FileExt = " & file.FileExt & "<BR>")
        Response.Write("FilePathName = " & file.FilePathName & "<BR>")
        Response.Write("ContentType = " & file.ContentType & "<BR>")
        Response.Write("ContentDisp = " & file.ContentDisp & "<BR>")
        Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")
        Response.Write("SubTypeMIME = " & file.SubTypeMIME & "<BR>")
        
    End If

End Select
%>
```

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

## #19 — emission, 2005-11-15T21:25Z

Skrivrättigheter till mappen?

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

## #20 — WebbisNet, 2005-11-15T21:26Z

ja det ska jag ha enligt webhotellet

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/137380-konvertera-till-aspsmartupload  
Nästa sida: https://www.webforum.nu/amne/asp/137380-konvertera-till-aspsmartupload/page2.md
