View Full Version : Can't Make No Executables Routine

02-07-2010, 09:11 PM
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:

<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.)
<input type="submit" name="submit" value="Submit"></center>

The script:

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?

Puffin the Erb
02-08-2010, 03:31 PM
It sounds like you have some kind of security software blocking .exe files, and rightly so.

02-08-2010, 03:48 PM
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.

Puffin the Erb
02-08-2010, 04:01 PM
It could be a file size issue, try uploading image files of approximately the same size.

02-09-2010, 02:44 AM
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.

02-09-2010, 05:18 AM
Have you looked at and tried this?

02-09-2010, 07:00 AM
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.