WN

WN (https://www.wn.se/forum/index.php)
-   Serversidans teknologier (https://www.wn.se/forum/forumdisplay.php?f=4)
-   -   ASPsmartupload (https://www.wn.se/forum/showthread.php?t=1960)

rille77 2004-04-02 03:30

Har problem när jag vill byta namn på filen jag laddar upp.
Så här ser min kod ut.


' Variables
' *********
Dim mySmartUpload
Dim FileType
Dim Image

FileType = Right(Request.Form("file"),3)
Image = Request.Querystring("id") & "." & FileType

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

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

' Save the files with their original names in a virtual path of the web server
' ************************************************** **************************
'intCount = mySmartUpload.Save("/images/drinkar")
' sample with a physical path
mySmartUpload.SaveAs("D:/kunder/sponsrat/krogliv.com/crop/images/" & Image & "")

response.redirect "crop.asp?image=drink" & Image & ""

foks 2004-04-02 09:55

Får du något felmeddelande?

rille77 2004-04-02 13:51

Nej inget felmeddelande alls, den sparar inte filen bara.

Det funkar så länge man inte försöker byta namn på den.

DanneG 2004-04-10 15:42

Citat:

Originally posted by rille77@Apr 2 2004, 00:30
Har problem när jag vill byta namn på filen jag laddar upp.
Så här ser min kod ut.


' Variables
' *********
Dim mySmartUpload
Dim FileType
Dim Image

FileType = Right(Request.Form("file"),3)
Image = Request.Querystring("id") & "." & FileType

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

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

' Save the files with their original names in a virtual path of the web server
' ************************************************** **************************
'intCount = mySmartUpload.Save("/images/drinkar")
' sample with a physical path
mySmartUpload.SaveAs("D:/kunder/sponsrat/krogliv.com/crop/images/" & Image & "")

response.redirect "crop.asp?image=drink" & Image & ""

Så här gjorde jag:

Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' *********
mySmartUpload.Upload
namn = mySmartUpload.Form("code_no")
ext = mySmartUpload.Files.Item(1).FileExt
' ************************************************** **************************

mySmartUpload.files.item(1).saveas "/shop/images/" & namn & "."&ext
bild = namn & "." & ext


Alla tider är GMT +2. Klockan är nu 07:10.

Programvara från: vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Svensk översättning av: Anders Pettersson