Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7600589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:56:47+00:00 2026-05-30T22:56:47+00:00

We are trying to use persits upload code to upload pictures to 2 different

  • 0

We are trying to use persits upload code to upload pictures to 2 different folders. It works when uploading to just one folder but not 2 folders.

Essentially, we have two folders, one is called img and the other is a subdirectory of img called small.

We grab 1 picture and upload same picture into both img and small folders.

So far, the picture gets uploaded to small folder but not to img folder.

Below is the relevant code followed by a link where I got my sample code from.

'Upload.asp
<form name="form" action="process.asp" method="post" ENCTYPE="multipart/form-data">
 <Table>
     <tr>
     <td class="body1" div align="right">Attach for IMG folder:</div></td>
     <td><INPUT NAME="file1" TYPE="FILE" value="" SIZE=30></td>
    </tr>
    <tr>
     <td class="body1" div align="right">Attach for SMALL folder:</div></td>
     <td><INPUT NAME="file2" TYPE="FILE" value="" SIZE=30></td>
    </tr>
    </table>
   </td>
 </tr>
 </table>
 <hr color="silver">

  <table width="100%" border="0" cellspacing="4" cellpadding="4">
    <tr>
      <td><div align="center">
    <input  type="image" name="submit" id="submit2" title="submit to db." border="0" src="images/submitbutton.jpg" width="142" height="47" alt="Submit Button">
        </div></td>
    </tr>
  </table>
</form>

'Process.asp
<%
Set Upload = Server.CreateObject("Persits.Upload")
' Limit file size to 5000000 bytes, throw an exception if file is larger
Upload.SetMaxSize 5000000, True

' Save to memory. Path parameter is omitted
Count = Upload.Save


' Two images must be selected
If Count <> 2 Then
   Response.Write "You must select 2 jpeg files."
   Response.End
End If

' Intercept all exceptions to display user-friendly error
On Error Resume Next


' Create two folders, ignore "already exists" error
Upload.CreateDirectory Server.MapPath("/img"), True
Upload.CreateDirectory Server.MapPath("img/small"), True

' Obtain File objects
Set File1 = Upload.Files("file1")
Set File2 = Upload.Files("file2")

' Build name from session ID
'Name = Session.SessionID

' Save
'File1.SaveAs (Server.MapPath("/img/" & File1.Ext))
'File2.SaveAs (Server.MapPath("/img/small/" & File2.Ext))

' Copy file 1 to img folder
File1.Copy (Server.MapPath("/img/" & File1.Ext))
' Delete from temp folder
File1.Delete

' Copy file 2 to small folder
File1.Copy (Server.MapPath("/small/" & File1.Ext))
' Delete from temp folder
File2.Delete


For Each File in Upload.Files
   If File.ImageType <> "JPG" Then
      Response.Write "The image type you are uploading is not a JPGE image."
      File.Delete
      Response.End
   End If
Next

  Dim objConn,connectstr,objRS,prodset,specialset,bncatset,featureset

  connectstr = "Provider=sqloledb; Data Source=scartmil.db.8911524.hostedresource.com; Initial Catalog=scartmil; User ID=999999; Password=8888;"
  Set objConn = Server.CreateObject("ADODB.Connection")
  objConn.Open connectstr

catdescription = Upload.Form(trim("catdescription"))
pcode          = Upload.Form("pcode")
pname          = Upload.Form(trim("pname"))
pdescription   = Upload.Form(trim("pdescription"))
pPhoto         = Upload.Form("pPhoto")
cstock         = Upload.Form("cstock")
cprice         = Upload.Form("UnitPrice")

'sanitize to avoid sql injection
catdescription = replace(catdescription,"'","''",1,-1,1)
pcode = replace(pcode,"'","''",1,-1,1)
pname = replace(pname,"'","''",1,-1,1)
pdescription = replace(pdescription,"'","''",1,-1,1)
pPhoto = replace(pPhoto,"'","''",1,-1,1)
cstock = replace(cstock,"'","''",1,-1,1)
cprice = replace(cprice,"'","''",1,-1,1)

'response.write cprice
'response.end
sql = "INSERT INTO products (ccategory, " & _
                             "ccode, " & _
                             "cname, " & _
                             "cdescription, " & _
                             "cimageurl, " & _
                             "cstock, " & _
                             "cprice) " & _
                 "VALUES (" & _
                         ""&catdescription&", " & _
                         "'"&pcode&"', " & _
                         "'"&pname&"', " & _
                         "'"&pdescription&"', " & _
                         "'"&pPhoto&"', " & _
                         ""&cstock&", " & _
                         ""&cprice&")"
                    'response.write sql
                    'response.end
       set rs = objConn.Execute(sql)

'ok record in, now retrieve the primary key

sql = "SELECT products.catalogID FROM products ORDER BY products.catalogID DESC"
'response.write sql
'response.end
set prodset = objConn.execute(sql)
if not prodset.EOF then
bCatalog = prodset("CatalogID")
end if


sql= "INSERT INTO bndCategoryProduct (bCategoryId, " & _
                                       "bCatalogId) " & _
                 "VALUES (" & _
                         ""&catdescription&", " & _
                         ""&bCatalog&")"
                    'response.write sql
                    'response.end

set bncatset = objConn.execute(sql)



objConn.Close
Set objConn=Nothing



%>

Here is the persits link:

http://www.aspupload.com/manual_memory.html

Please don’t pay attention to the insert code; it works fine.

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:56:49+00:00Added an answer on May 30, 2026 at 10:56 pm

    Are you sure you have the same write permissions to both folders? also, did you notice your folders are different. If you do have the permissions set correctly, the other issue I see is your folders. You have /img and img/small Those could potentially be two different img folders.

    Upload.CreateDirectory Server.MapPath(“/img”), True
    Upload.CreateDirectory Server.MapPath(“img/small”), True

    The next potential problem I see is in the code below. Just under ‘ Copy file 2 to small folder you have File1.copy. Shouldn’t that be File2.Copy.

    '# Copy file 1 to img folder
    File1.Copy (Server.MapPath("/img/" & File1.Ext))
    '# Delete from temp folder
    File1.Delete
    
    '# Copy file 2 to small folder
    File1.Copy (Server.MapPath("/small/" & File1.Ext))
    '# Delete from temp folder
    File2.Delete
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Trying to use a guid as a resource id in a rest url but
Trying to use this code to connect the AD PrincipalContext context = new PrincipalContext(ContextType.Domain,
I'm trying to use the following code to persist the current list of local
I am trying to persist and ArrayList, but it does not work. Everything is
I'm trying to use the XDT in a 4.0 web application and I just
I am trying to use a GroupStyle but instead of showing the groupname as
I was trying use a set of filter functions to run the appropriate routine,
I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
I am trying use a Java Uploader in a ROR app (for its ease

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.