Hello!
I'm currently involved in a project where the user is able to upload a PDF file through an ordinary FORM with an file type input control. The problem is that it doesn't seem to work as it should in Internet Explorer 5.1 for Macintosh (Mac OS 9). I get a wierd error message saying (translated from swedish) per beta:
Could not open "Opening location (URL): <!-- m --><a class="postlink" href="http://101.102.103.104:5481/application_site.dll?UploadFile">http://101.102.103.104:5481/application ... UploadFile</a><!-- m -->"
(disregard the strange IP, I made it up for this post)
The file is still uploaded, I think, and no problem except for the error message occurs. Subsequent attempts to click the "send"-button works without even displaying the error.
This upload procedure is done in a FORM which uses the POST method and ENCTYPE="multipart/form-data". The site is ISAPI based, so I make a DLL call from the form, and send some parameters along with the filedata. The form is not submitted with a submit button directly, instead I call a javascript function which does a bit of field validation and also modifies one or two of the input fields in the form, before i end the javascript function with document.UPLOADFORM.submit(); ...
Is there some strange known issue with this browser, upload forms and Macintosh? Have any of you ever encountered something like this?
Any help on this issue would be really valuable to me!
Thanks!
/Komet
This is the code:
------------------------------------------------
Javascript:
-----------
function send()
{
var name = document.UPLOADFORM.FILEDATA.value;
var file = "";
var last1 = name.lastIndexOf("/");
var last2 = name.lastIndexOf("\\");
if(last1 == last2 == -1)
file=name;
else
{
if(last1<last2)
last1=last2;
file=name.substring(last1+1);
}
if(file.length==0)
{
alert("Filename required");
return;
}
if (file.indexOf('.pdf') > 0 || file.indexOf('.PDF') > 0 || file.indexOf('.doc') > 0 || file.indexOf('.DOC') > 0)
{
document.UPLOADFORM.P2.value=file;
document.UPLOADFORM.submit();
}
else
alert ("The file must be of the type .PDF or .DOC !");
}
------------------------------------------------
HTML:
-----------
<form ACTION="/application_site.dll?UpLoadFile" ENCTYPE="multipart/form-data" METHOD="POST" NAME="UPLOADFORM">
<tr>
<td class="MAINTEXT-BOLD">
<input type="hidden" name="P1" value=http://www.webdeveloper.com/forum/archive/index.php/"FIL">
<input type="hidden" name="P2" value="">Load file:
</td>
<td class="inputrub">
<input type="file" name="FILEDATA" size="30" maxlength="250">
<input type="button" value="Spara" onClick="javascript:send();">
<input type="hidden" name="LOADED" value="1">
</td>
</tr>
<tr>
<td></td>
<td>
</td>
</tr>
</form>
-----------------------------------------------
I'm currently involved in a project where the user is able to upload a PDF file through an ordinary FORM with an file type input control. The problem is that it doesn't seem to work as it should in Internet Explorer 5.1 for Macintosh (Mac OS 9). I get a wierd error message saying (translated from swedish) per beta:
Could not open "Opening location (URL): <!-- m --><a class="postlink" href="http://101.102.103.104:5481/application_site.dll?UploadFile">http://101.102.103.104:5481/application ... UploadFile</a><!-- m -->"
(disregard the strange IP, I made it up for this post)
The file is still uploaded, I think, and no problem except for the error message occurs. Subsequent attempts to click the "send"-button works without even displaying the error.
This upload procedure is done in a FORM which uses the POST method and ENCTYPE="multipart/form-data". The site is ISAPI based, so I make a DLL call from the form, and send some parameters along with the filedata. The form is not submitted with a submit button directly, instead I call a javascript function which does a bit of field validation and also modifies one or two of the input fields in the form, before i end the javascript function with document.UPLOADFORM.submit(); ...
Is there some strange known issue with this browser, upload forms and Macintosh? Have any of you ever encountered something like this?
Any help on this issue would be really valuable to me!
Thanks!
/Komet
This is the code:
------------------------------------------------
Javascript:
-----------
function send()
{
var name = document.UPLOADFORM.FILEDATA.value;
var file = "";
var last1 = name.lastIndexOf("/");
var last2 = name.lastIndexOf("\\");
if(last1 == last2 == -1)
file=name;
else
{
if(last1<last2)
last1=last2;
file=name.substring(last1+1);
}
if(file.length==0)
{
alert("Filename required");
return;
}
if (file.indexOf('.pdf') > 0 || file.indexOf('.PDF') > 0 || file.indexOf('.doc') > 0 || file.indexOf('.DOC') > 0)
{
document.UPLOADFORM.P2.value=file;
document.UPLOADFORM.submit();
}
else
alert ("The file must be of the type .PDF or .DOC !");
}
------------------------------------------------
HTML:
-----------
<form ACTION="/application_site.dll?UpLoadFile" ENCTYPE="multipart/form-data" METHOD="POST" NAME="UPLOADFORM">
<tr>
<td class="MAINTEXT-BOLD">
<input type="hidden" name="P1" value=http://www.webdeveloper.com/forum/archive/index.php/"FIL">
<input type="hidden" name="P2" value="">Load file:
</td>
<td class="inputrub">
<input type="file" name="FILEDATA" size="30" maxlength="250">
<input type="button" value="Spara" onClick="javascript:send();">
<input type="hidden" name="LOADED" value="1">
</td>
</tr>
<tr>
<td></td>
<td>
</td>
</tr>
</form>
-----------------------------------------------