473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

IE file upload problem

1
I have a very simple form and perl script that is to upload a jpg file. I am not familiar with the perl language but copied the code from a text book.

It works fine with all browsers except IE. !!!!!

The code is able to validate that it is a jpg but never gets to the debugging statement 'in loop"

I have seen numerious complaints via google searches about IE and uploads but
am unable to decipher the solution.

Any help will be GREATLY appreciated.



============= HTML CODE ============================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<HTML [5]>
<HEAD></HEAD>
<BODY>
<FORM ACTION="/cgi-bin/upload2.cgi" METHOD="post" ENCTYPE="multipart/form-data">
Image to upload:......
<INPUT TYPE="file" NAME="uploadfile" size="50">
<br><br>
Your Email Address: <INPUT TYPE="text" NAME="email_address">

<br><br>
Enter Password:.......
<INPUT TYPE="text" NAME="vps_password">

<br><br>
<input type="submit" name="Submit" value="Submit Form">
</BODY>
</HTML>




============== PERL SCRIPT CODE ===============================


#!/usr/bin/perl -w

use strict;
use CGI ':standard';

print "Content-type: text/html\n\n";

print "Preparing to upload your image. Must be type jpg and LE 1M. ";

print "step 1";
my $file= param('uploadfile');

print "step 2";
my $info= uploadInfo ($file);

print "step 3";
my $type= $info -> {'Content-Type'};

my $vps_password;

$vps_password = param ('vps_password');

if ($vps_password eq 'vienna') {
print "<p> password ok";
} else {
print "<p> Invalid Password. Call Sharon." || Error3 ();
exit;
}




$file =~ s/.*[\/\\](.*)/$1/;



if ($file) {


# open (UPLOAD, ">C:/vps-va/uploadphoto/$file") || Error ();
open (UPLOAD, ">../uploadphoto/$file") || Error ();

binmode UPLOAD;

my $info = uploadInfo($file);
my $type= $info->{'Content-Type'};

print "<p>You want to upload
<b>$file</b> with a MIME type of
<b>$type<b>";


if ($file =~ /\.jpg/ or $file =~ /\.JPG/ ) {

print "<p>starting to upload";

my ($data, $length, $chunk);
while ($chunk = read ($file, $data, 1024)) {
print "in loop";
print UPLOAD $data;

$length += $chunk;
if ($length > 1024000) {
print "<p> That image is too big. The limit is 1 Meg. I'm deleting.";
# unlink ("C:/vps-va/upload/$file") || Error2 ();
unlink ("../uploadphoto/$file") || Error2 ();
exit;
}
}
close (UPLOAD);
print ("<p> Upload of $file was successful. Size was $length bytes.");

} else {

print "<p>Must be jpg. Image not uploaded.";
unlink ("../uploadphoto/$file") || Error2 ();
}
} else {
print "<p> No file was chosen.";
}

sub Error {
print "Error routine 2.1 could not open";
print "Couldn't open temporary file: $!";
exit;
}
sub Error2 {
print "Couldn't delete file: $!";
exit;
}
sub Error3 {
print "Bad Password";
exit;
}
Nov 29 '06 #1
1 2694
GunnarH
83
I'm the author of a Perl module for facilitating file uploads: CGI::UploadEasy. It has not been reported to have the limitation you mention.
Nov 30 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
3
by: Bijoy Naick | last post by:
I've written a simple file upload user control in VB .NET. It comprises of an InputFile HTML Server Control, an Upload button and a message label. User clicks on the Browse button of the...
6
by: tshad | last post by:
I have an upload file input as: <input id="MyFile" style="width:300px" type="File" runat="Server"> This works fine, but I find that if my page doesn't pass validation during postback, the page...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
4
by: Matt Jensen | last post by:
Howdy I've got a rather strange issue occuring. I used forms based .NET authentication, although I'm also setting some session variables when people login. However, I've found when people use...
5
by: William LaMartin | last post by:
I have a VB ASP.Net application where the user can upload a file using the FileUpload server control. I also want a thumbnail to be created for this file. Unfortunately I can see no means to...
4
by: riteshjain82 | last post by:
Hi, Please go through this: I am having a file (default.asp) on which i am taking many details from a user before mailing it to someone. I have also provided the user with a facility of...
6
by: Vic Spainhower | last post by:
Hello, I am trying to do a FTP file upload which works fine on my localhost but on my ISP server it fails. I can't seem to find where I can go to find the specific cause of the failure. In both...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
1
by: pbd22 | last post by:
hi. i have been posting this here and elsewhere a lot and can't seem to get resolution on this problem. i have been trying to upload files using a hidden iframe to a asp.net/vb.net form. the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.