Hi,

I can upload a file with this setup :

- the "form.js" jQuery Form plugin script
http://jquery.malsup.com/form/jquery.form.js?2.33

- the "files.php" which upload my files and print a validation
message
...
move_uploaded_file($_FILES["file"]["tmp_name"], $_POST
["destinationpath"].$_FILES["file"]["name"]);
echo ($_POST["destinationpath"].$_FILES["file"]["name"]);
...

- an "index.php" with html upload form and a div who receive the
message.
...
<form id="upload" action="files.php" method="POST" enctype="multipart/
form-data">
  <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
  <input type="hidden" name="destinationpath" value="/path/" />
  <input type="file" name="file" />
  <input type="submit" value="Upload" />
</form>
<div id="output"></div>
...

- my script to manage the upload :
...
$('#upload').bind('submit', function() {
  $(this).ajaxSubmit({
    target: '#output',
    url: 'files.php',
    beforeSubmit: clearOutput,
    success:      writeOutput
  });
  return false;
});
...


It works, I mean "files.php" is called, the file is uploaded and I
stay on the "index.php" which receive the message.

Well, now I want to insert the html form on a node of the file tree.
Same setup, except I got a js script where I create nodes :
...
$node.append('<form id="upload" action="files.php" method="POST" ...
same form as above ... </form><div id="output"></div>');
...

Every thing works fine, my form appear on the tree, my file is
uploaded, i got the message BUT on "http://address/files.php"; (which
contains only the message...) instead of "http://address/index.php"; !

I don't understand why are there differents results...

Could you help me ? Tanks.

Reply via email to