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.

------=_NextPart_000_0008_01C0C187.3F6E1AA0
Content-Type: text/plain;
	charset="iso-8859-1"
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:\64.225.39.123\Store\images\productimages"

   if Upl.Form("File1").TotalBytes <> 0 then
    strName =3D Mid(Upl.UserFilename, InstrRev(Upl.UserFilename, "\") + 
1)
    ' 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
    else
     strName =3D "Error uploading the file: " & strName &". Err: " & 
Err.Number &" - "&Err.Description
     Err.Clear
    end if
         
    if Not blnVal then
     Upl.Delete
    end if
   end if

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

John

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




  Return to Index