Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Aug 2004
    Posts
    364
    Thanks
    9
    Thanked 4 Times in 4 Posts

    Can't Make No Executables Routine

    Dear Friends:
    I am making an image upload script, and I am trying to use a file extension check sub routine that validates files only with a proper image file exension. It works on zip files and doc files. but when I try an executable file, I guess it crashes my internet. My internet slows to a crawl until I restart my modem. I tried this several times, and the same thing happened.
    So, I abandoned the upload script, and made a simple script that prints the file name. Same thang happened.
    Here's the form:
    Code:
    <form method="post" action="/cgi-bin/resizer/resizer.pl" ENCTYPE="multipart/form-data">
    <b>Select File:</b> <input type="file" name="file"> (Browse your computer for an image.)
    <br>
    <br>
    <input type="submit" name="submit" value="Submit"></center>
    </form>
    The script:
    Code:
    #!/usr/bin/perl
    use strict;
    use warnings;
    use CGI;
    use CGI::Carp qw(fatalsToBrowser);
    my $query = new CGI; 
    my $file = $query->param("file");
    print "Content-type: text/html\n\n";
    print "$file";
    I don't understand what is happening. Is my browser trying to execute the file?

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    It sounds like you have some kind of security software blocking .exe files, and rightly so.

  • #3
    Regular Coder
    Join Date
    Aug 2004
    Posts
    364
    Thanks
    9
    Thanked 4 Times in 4 Posts
    Thanks for the reply.
    I just wonder if someone mistakenly tries to upload an .exe file, if it will crash their internet as well. Many people wouldn't know what to do if that happened, if they even knew what happened. I'm still wondering if the browser is trying to execute it or what.
    I might try javascript validation, because I really need to stop it before it starts. The browser is showing to be uploading a certain percent when this happens, and I always close the browser.

  • #4
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    It could be a file size issue, try uploading image files of approximately the same size.

  • #5
    Regular Coder
    Join Date
    Aug 2004
    Posts
    364
    Thanks
    9
    Thanked 4 Times in 4 Posts
    Quote Originally Posted by Puffin the Erb View Post
    It could be a file size issue, try uploading image files of approximately the same size.
    The problem I'm having happens even when I'm not uploading the file. The script above just displays the filename.

    I'm gonna try this on my offline personal server, and see if I can figure out what's going on.

    Thanks for the suggestions.

  • #6
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,836
    Thanks
    2
    Thanked 158 Times in 153 Posts
    Have you looked at and tried this?
    http://search.cpan.org/~lds/CGI.pm-3...E_UPLOAD_FIELD

  • #7
    Regular Coder
    Join Date
    Aug 2004
    Posts
    364
    Thanks
    9
    Thanked 4 Times in 4 Posts
    That looks like a good idea to set the content type, and I guess I will use it. Thanks for suggesting that. It's easier than using my sub routine.

    But, the issue I am having doesn't seem to have anything to do with uploading the file, since it happens even when I use the code above, which isn't file uploading code. I'm thinking this is going to happen even if I don't even have a script.

    I have an idea that since the executable I was using for this test is an install file, maybe the browser or windows starts trying to install when I click the submit button. I will try another type of .exe file tommorrow, and see what happens.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •