File upload problem(firefox works, IE not)

D

db

Hi@all,

I am always thinking that there is no problems that I can not solve.
But now i changed my idea......

My problem is that i use javascript to generate a form, the form
contains a normal file uploader. The code is somehow like this:

var inputform = document.getElementById('inputform');
if (!inputform) {
inputform = document.createElement('form');
inputform.setAttribute('enctype','multipart/form-data');
inputform.setAttribute('method','post');
inputform.setAttribute('action', 'programMotes.php');

filetext=document.createTextNode(' Mote Executable: ');

exefile=document.createElement('input');
exefile.setAttribute('type', 'file');
exefile.setAttribute('name', 'moteProgramFile');

text2=document.createTextNode(' ');

inputButton=document.createElement('input');
inputButton.setAttribute('type', 'submit');
inputButton.setAttribute('value', 'Flash the marked motes');

hidden = document.createElement('input');
hidden.setAttribute('type', 'hidden');
hidden.setAttribute('name', 'sent');
hidden.setAttribute('value', 'true');

inputform.appendChild(tbl);
inputform.appendChild(filetext);
inputform.appendChild(exefile);
inputform.appendChild(text2);
inputform.appendChild(inputButton);
inputform.appendChild(hidden);

br=document.createElement('br');
br2=document.createElement('br');
finishedText=document.createTextNode('Loaded.');
inputform.insertBefore(br, filetext);
inputform.insertBefore(finishedText, br);
inputform.insertBefore(br2, finishedText);

content.appendChild(inputform);
}

And then in corresponding php file moteProgramFile.php:

$target_path = "uploads/";

$target_path = $target_path .
basename($_FILES['moteProgramFile']['name']);
echo $target_path;

if(move_uploaded_file($_FILES['moteProgramFile']['tmp_name'],
$target_path))
{
echo "The file ". basename( $_FILES['moteProgramFile']['name']).
" has been uploaded";
}
else
{
echo "There was an error uploading the file, please try again!";
}

With using firefox, there is absolutely no problem, but with using IE,
the file can just not be uploaded! Does someone have an idea?

thanks in advance

db
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top