Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old January 22nd, 2007, 06:36 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I use JS/REG EX to validate 'is the file a .jpg, .jpeg, or .gif' at the point where you upload the file like so:

    function validate()
    {
       if (document.updateForm.File1.value=="")
       {
          alert('Click browse to select a file for upload to proceed');
          updateForm.File1.focus();
          return (false);
       }
       if ((/.(gif|jpe?g)$/i.test(document.updateForm.File1.value))==false)
       {
           alert('You may only upload .jpg, .jpeg, or .gif images (in case sensitive)');
           return (false);
       }
           return(true);
    }

and fire it like so:
<FORM NAME="updateForm" METHOD="post" encType="multipart/form-data" ACTION="FileUploadDetails.asp" onSubmit="return validate();">

This way your file will not get uploaded to the web server unless it complies. I dont resize images on the fly however it sounds like dparsons is onto that one.


Wind is your friend
Matt
Reply With Quote
  #12 (permalink)  
Old January 22nd, 2007, 09:37 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Slick function Matt ^^

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Reply With Quote
  #13 (permalink)  
Old January 23rd, 2007, 07:37 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , Norway.
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

... Matt41, can you explain the "$/i.test" in;

if ((/.(gif|jpe?g)$/i.test(document.updateForm.File1.value))==false)

Mvh
grstad
Reply With Quote
  #14 (permalink)  
Old January 23rd, 2007, 09:36 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

This was written a while ago. REG EX scare me more than a little and I use them very little, there may be others around here who can explain better, or correct me if I am slightly off.

The RE EX part:
/.(gif|jpe?g)$/i

/ are delimiters (required)
gif|jpe?g is a pattern asking if the chars after the . contains gif or jpg or jpeg

i says ignore case (optional)

The JS part:
.test

The test method Returns a Boolean value that indicates whether or not a pattern exists in a searched string Syntax = rgexp.test(str)

I hope I have answered your question


Wind is your friend
Matt
Reply With Quote
  #15 (permalink)  
Old January 23rd, 2007, 09:39 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

additionaly; thanking you dparsons

Wind is your friend
Matt
Reply With Quote
  #16 (permalink)  
Old January 25th, 2007, 10:06 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , Norway.
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

...this code is a bit beyond ny knowledge, but yes some of it I do understand.

Just one more thing; what is the "REG EX"?

It seems also that some of the components used in my app are missing. It is about email-sending and uploading the images into my app. It worked so fine the other day!

What is your knowledge regarding this?

Mvh
grstad :-@

Internet has become favorable with that tool...thank you Tim Berners-Lee!
Reply With Quote
  #17 (permalink)  
Old January 25th, 2007, 10:20 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

RegEx == Regular Expression's. Basically they are used to look for paterns in a given string and, really, regex is out of the scope of this thread. If you would like to learn more about them this is the site I used when I first started using RegEx in .NET.

http://www.regular-expressions.net/

I should point out that this site is about RegEx as a whole and isn't focused on how to use them in any particular language but the author does provide samples of how you would do things in certain languages.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Reply With Quote
  #18 (permalink)  
Old January 25th, 2007, 11:10 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , Norway.
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hei!

Thank you for answering. ...but regarding my missing components,(mail and upload), what CLSID are they refering to? How can they suddenly disapear from my PC? Does the registry update when reinstal (format the disk) WinXP?

Mvh
grstad :-@

Internet has become favorable with that tool...thank you Tim Berners-Lee!
Reply With Quote
  #19 (permalink)  
Old January 29th, 2007, 07:01 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Im confused, you say:

;;;It seems also that some of the components used in my app are missing. It is about email-sending and uploading the images into my app. It worked so fine the other day!

If it worked the other day it should still be working, please explain in more details. EG What's the detailed error, line number and 'problematic code only'

Wind is your friend
Matt
Reply With Quote
  #20 (permalink)  
Old January 30th, 2007, 03:28 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , Norway.
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

... I am now working with three different aspects regarding my web-app.

1) Sending an email from within the app,

2) A clients uploading of an image and the apps displaying of that image, and

3) paging when requesting a recordset

As far as I now have realised, sending email requires the use of CDOSYS when using winxp. I belive something is missing inside my PC, this CDO-thing! When calling MailMessage, is there a request towards the register for any executable code? The same goes for the upload-thing? When I try to use upload(), does any component come in use? The paging - I am still trying to dissect that code!

I will now consentrate towards the image-upload. I'll post the next error, I'll just get the sql in place. The sql that updates the db-record and setting the field; field_Photo = <img src = "c:/photo/the_file_uploaded">

There must be some abra-cadabra aboat email and upload!

Mvh
grstad :)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Input type=file apply a filter?? italiansensation ASP.NET 1.x and 2.0 Application Design 3 May 24th, 2006 04:06 AM
INPUT type=file (Urget Help) surendran PHP How-To 1 April 9th, 2006 12:42 PM
input type file darkhalf Javascript 1 October 29th, 2005 02:17 AM
defining location for input type file bleitner Javascript How-To 1 August 24th, 2004 08:15 AM
<input type="File"> - Specify File Type and Path gp_mk Classic ASP Basics 2 August 2nd, 2004 03:07 AM



All times are GMT -4. The time now is 07:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.