CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
File Uploading Type limitations

 



Pro_4
User

Apr 15, 2001, 6:34 PM

Post #1 of 3 (217 views)
File Uploading Type limitations Can't Post

hey,
How can you limit the type of files that can be uploaded. For example they can only uploaded files ending with .txt and .gif .

thanks in advance

¿HELP?


sleuth
Enthusiast

Apr 16, 2001, 12:59 AM

Post #2 of 3 (213 views)
Re: File Uploading Type limitations [In reply to] Can't Post

 
Well, say you store your filename into $file,

($file_name = $file)=~s~.*\.(.*)~$1~;
if ($file_name eq "txt" || $file_name eq "gif"){
$upload=1;
}

Then surround your upload code with

if ($upload){
# upload code
}else{
print "That file format is not accepted.";
}

Tony



Pro_4
User

Apr 17, 2001, 5:07 PM

Post #3 of 3 (200 views)
Re: File Uploading Type limitations [In reply to] Can't Post

Thanks, wow this is the first post that has ever been answered for me :) I am happy. or maybe the question was just way to easy. lol well thanks anyways

¿HELP?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives