[SOLVED] File upload -> doesn't work with IE?
Moderator: General Moderators
-
raging radish
- Forum Commoner
- Posts: 32
- Joined: Sun Nov 14, 2004 3:02 pm
- Location: Toronto
[SOLVED] File upload -> doesn't work with IE?
I've bashed together a script to upload .jpg files. It works perfectly with Linux/Mozilla/Galeon. It works under Windows with Firefox. It doesn't work under Windows and IE 6.
Anybody have a clue as to why?
Anybody have a clue as to why?
Last edited by raging radish on Mon Dec 06, 2004 6:36 pm, edited 1 time in total.
Make sure you set the enctype in your form tag.
Code: Select all
<form enctype="multipart/form-data"....-
raging radish
- Forum Commoner
- Posts: 32
- Joined: Sun Nov 14, 2004 3:02 pm
- Location: Toronto
That's the first thing I checked and it looks ok to me. Here it is for reference.
The only real difference between this and the example shown on php.net is that this page refers to itself, rather than another file/page. Is it possible that there's an issue with the page referring to itself?
Code: Select all
<form enctype="multipart/form-data" action="<?php print $_SERVERї'PHP_SELF']?>" method="post">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="204800" />
Image 1 <input type="file" name="fupload"/><br/>
<input type="submit" value="Upload"/>
</p>
</form>-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
-
raging radish
- Forum Commoner
- Posts: 32
- Joined: Sun Nov 14, 2004 3:02 pm
- Location: Toronto
After php has parsed the page:
The source is the same in IE and Firefox (Windows)
Edit: I should probably add that "file_upload.php" is the correct name.
Code: Select all
<form enctype="multipart/form-data" action="/file_upload.php" method="post">Edit: I should probably add that "file_upload.php" is the correct name.
-
raging radish
- Forum Commoner
- Posts: 32
- Joined: Sun Nov 14, 2004 3:02 pm
- Location: Toronto
Code: Select all
$ThisURI = $_SERVERї'PHP_SELF'];
str_replace('', '/', $ThisURI);
echo $ThisURI;I have never used one in a page that posts to itself, and it wouldn't surprise me if ie became confused by it.
-
raging radish
- Forum Commoner
- Posts: 32
- Joined: Sun Nov 14, 2004 3:02 pm
- Location: Toronto
I don't think it's the slash causing the issue. I rewrote the page to call the php script on a separate page and the source parses like this:
Still doesn't work in IE, fine in the other browsers.
slowly going insane :-/
Code: Select all
<form enctype="multipart/form-data" action="upload.php" method="post">slowly going insane :-/
Maybe it's the forward slashes in the form then...
Try changing
to
While still keeping the other forward slash removed as well.
Try changing
Code: Select all
Image 1 <input type="file" name="fupload"/><br/>
<input type="submit" value="Upload"/>Code: Select all
Image 1 <input type="file" name="fupload"><br/>
<input type="submit" value="Upload">-
raging radish
- Forum Commoner
- Posts: 32
- Joined: Sun Nov 14, 2004 3:02 pm
- Location: Toronto
Do you have any form tags that aren't closed above that one? Did you properly close that form tag? Can you post the source code for the entire page please?
I know for a fact this code works... this is something I wrote a long time ago.
I know for a fact this code works... this is something I wrote a long time ago.
Code: Select all
<h2>Upload New File</h2>
<form enctype="multipart/form-data" action="account_manager.php?mode=10" method="post">
<table class="box" cellpadding="0" cellspacing="0">
<?php
if ($error != '') // someone goofed somewhere
{
?>
<tr>
<td class="bline" colspan="2" align="center" style="color: #9B202C;"><b>ERROR: </b><?php echo $error; ?></td>
</tr>
<?php
}
?>
<tr>
<td width="18%" class="bline" style="text-align: right;"><b>File Name:</b></td>
<td width="82%" class="blline" ><input class="upload" name="userfile" type="file"></td>
</tr>
<tr>
<td colspan="2" class="bline" style="text-align: center;" ><b>File Description</b></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;"><textarea name="description" class="services"></textarea></td>
</tr>
<tr>
<td colspan="2">Please give us a detailed description of this file. Include
information such as what this file is, how you would like it used, what webpage you would like it on,
what if any changes need to be made etc.</td>
</tr>
<tr>
<td colspan="2" class="bline" style="text-align: right;">
<input type="hidden" name="upload_file" value="true">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size_bytes; ?>">
<input class="button" type="submit" value="Transfer File">
</td>
</tr>
</table>
</form>-
raging radish
- Forum Commoner
- Posts: 32
- Joined: Sun Nov 14, 2004 3:02 pm
- Location: Toronto
Here it is. All the tags seem to be closed properly.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Image upload</title>
<LINK href="sn/ss/ss.css" type=text/css rel=stylesheet>
</head>
<body>
<!--DON'T CHANGE THIS-->
<div id="leftcontent">
<?php
include("sn/sn_include_ex.txt");
?>
</div>
<!--OK, YOU CAN CHANGE IT NOW-->
<div id="rightcontent">
<h3 align="left">Image Upload Page</h3>
<p>Use this page to upload your images.<br/>
<ul>
<li>Image files must be .jpg.
<li>Maximum filesize (each) is 2 megabytes.
</ul><br/>
<form enctype="multipart/form-data" action="upload.php" method="post">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="204800">
Image 1 <input type="file" name="fupload"><br/>
<input type="submit" value="Upload">
</p>
</form>
</div>
</body>
</html>-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
First, what exactly happens? Not "it doesn't work", but does it hang? Does it give you an error? etc..
Secondly, paste ALL relevant code (preferably in
Secondly, paste ALL relevant code (preferably in
Code: Select all
tags)There was an <h3 tag that was not closed, and some other miscellaneous things that I fixed.
Try this.
Try this.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Image upload</title>
<LINK href="sn/ss/ss.css" type=text/css rel=stylesheet>
</head>
<body>
<!--DON'T CHANGE THIS-->
<div id="leftcontent">
<?php
include("sn/sn_include_ex.txt");
?>
</div>
<!--OK, YOU CAN CHANGE IT NOW-->
<div id="rightcontent">
<h3> align="left">Image Upload Page</h3>
<p>Use this page to upload your images.</p>
<ul>
<li>Image files must be .jpg.</li>
<li>Maximum filesize (each) is 2 megabytes.</li>
</ul><br/>
<form enctype="multipart/form-data" action="upload.php" method="post">
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="204800">
Image 1 <input type="file" name="fupload"><br/>
<input type="submit" value="Upload">
</p>
</form>
</div>
</body>
</html>