p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Sa File up

Message #1 by "Daniel O'Dorisio" <dodorisio@h...> on Sat, 7 Apr 2001 22:10:08 -0400
This is a multi-part message in MIME format.

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable

Hello Daniel,

Try using the SaveAs method instead of the Save method.

dim blnVal
dim strBase, strPath, strName

blnVal =3D false
strBase =3D "d:\\Store\images\productimages"

   if Upl.Form("File1").TotalBytes <> 0 then
    strName =3D Mid(Upl.UserFilename, InstrRev(Upl.UserFilename, "\") + 
    ' change path1 to whatever you need
    strPath =3D Server.MapPath(strBase & "\path1\")
    On Error resume next
    Upl.Form("File1").SaveAs strPath & strName
    if Err =3D 0 then
     blnVal =3D true
     strName =3D "Error uploading the file: " & strName &". Err: " & 
Err.Number &" - "&Err.Description
    end if
    if Not blnVal then
    end if
   end if

' do it again... or better yet make the above code into a function so 
you can reuse it


----- Original Message -----
From: "Daniel O'Dorisio" <dodorisio@h...>
To: "Code Clinic" <proasp_codeclinic@p...>
Sent: Sunday, April 08, 2001 4:10 AM
Subject: Sa File up

> Hey...
> i am trying to create a upload page for the back-end administration of 
> ecommerce site. and what i have is 3 files (thumb image, reg image, 
> large image) that i want to upload to different directories. the 
> all the picture names are the productid num so it makes it easy to
> here is what i am doing right now
> <%
> Dim upl
> Set upl =3D Server.CreateObject("softArtisans.FileUp")
> upl.path =3D "d:\\Store\images\productimages\thumbs"
> upl.form("thumbimg").save
> upl.path =3D "d:\\Store\images\productimages\regular"
> upl.form("regimg").save
> upl.path =3D "d:\\Store\images\productimages\large"
> upl.form("largeimg").save
> set upl =3D nothing
> Response.Write "File Uploaded"
> %>
> but the prob is... it uploads all the images to the one directory 
> and not to each dir. am i overestimating the abilities of sa-file up. 
> checked the documentation, but havnt found anything so far.. i am 
> looking though. i kinda want them to all be in one form as it will be 
> prodict images for one product. also, i need to get the short filename 
> of the whole thing (xxxxx.jpg instead of c:\my images\xxxxx.jpg) any 
> on how that can be done. can it with the file field?
> thanks!
> Daniel

  Return to Index