Solved

ASPUpload SetMaxSize syntax problem

Posted on 2004-10-08
8
671 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

14 Experts available now in Live!

Get 1:1 Help Now