Solved

ASPUpload SetMaxSize syntax problem

Posted on 2004-10-08
8
674 Views
Last Modified: 2008-01-09
the code below produces this ASP error:

Expected end of statement

/chav.asp, line 148

upl.SetMaxSize = 3000000, True

-----------------------------------------------------------
My sub:

Sub UploadFile

       Dim upl, NewFileName

       Set upl = Server.CreateObject("ASPSimpleUpload.Upload")
       upl.SetMaxSize = 3000000, True
       file_name = upl.ExtractFileName(upl.Form("upload"))

      If isValidFile(file_name) then
             If Len(upl.Form("upload")) > 0 and isFileSizeOK(upl.OriginalSize) Then
                   NewFileName = "/Uploads/" & file_name

                   If upl.SaveToWeb("upload", NewFileName) Then
                         Response.Write("Your file was successfully uploaded.")

                                    strSQL = "sp_AddUploadedFile"
                                    strSQL = strSQL & " @RegID = '" & Session("regID") & "',"
                                    strSQL = strSQL & " @FileName = '" & file_name
                                    strSQL = strSQL & " @DateUploaded = '" & Now() & "'"

                        Set Query = objConnection.Execute(strSQL)
                   Else
                         Response.Write("There was an error uploading your avitar file.")
                   End If
             else
                  Response.Write ("Your file size must be 30 kb or less")
             End If
      else
            Response.Write("Your file name type is not a .jpg, .jpeg, .gif, or .bmp")
      End If

End Sub
0
Comment
Question by:dba123
  • 5
  • 3
8 Comments
 
LVL 1

Author Comment

by:dba123
ID: 12265171
the ISP I am using says they are using Simple ASP Upload.  I asked them for the actual site and they gave me this:

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

I browsed the site which is where I got that function to set the upload size limit but now that I look at that site, I see no "SaveToWeb" function like I have in my sub.  The file upload worked just fine before I added the if statements for the file size and such.  So I dont' know if this is the actual site I should be referencing here....maybe it doesn't understand that function SetMaxSize that I'm using here.
0
 
LVL 15

Expert Comment

by:gladxml
ID: 12265176
take out the = sign

upl.SetMaxSize = 3000000, True


it must be

upl.SetMaxSize 3000000, True

0
 
LVL 15

Accepted Solution

by:
gladxml earned 500 total points
ID: 12265185
I think your syntax is wrong base on the link that you have provided.

http://www.aspupload.com/object_upload.html#SetMaxSize

The link state below and syntax as well regrading the SetmaxSize

Sub SetMaxSize (MaxSize As Long, Optional Reject)
Specified the maximum allowed size of the individual files to be uploaded. Reject specifies whether files larger than MaxSize should be rejected (if set to True) or truncated (if set to False or omitted).
Usage:

Upload.SetMaxSize 150000, True

Happy programming...
0
 
LVL 1

Author Comment

by:dba123
ID: 12265196
how stupid, didn't even see the =...duh
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:dba123
ID: 12265201
actually now the error is:

Object doesn't support this property or method: 'upl.SetMaxSize'

again, I don't think this is the right webpage for the syntax.  I also see that the orginal makers of Simple ASP Upload are no longer around?
0
 
LVL 1

Author Comment

by:dba123
ID: 12265215
ok, the ISP does have ASPUpload installed afterall....as well as Simple ASP Upload so my object should have no problems.  This sub is coded in ASP Simple Upload so I need to somehow find that damn page for the objects....wherever the hell this exists now that the makers must have skipped out.
0
 
LVL 1

Author Comment

by:dba123
ID: 12265216
I'm starting a new thread.
0
 
LVL 15

Expert Comment

by:gladxml
ID: 12265482
dba123,

Have you tried it in your worstation.

Also you can asked your ISP if they do support ASPUpload and Simple ASP Upload if they dont encounter the same problem as you do.

Happy programming...

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now