Hello,
    currently I want to implement a multiple upload using a listbox.
    I have 2 link which will dynamically add or remove a file to/from the
list box,
    I'm writing it as a java script as below.
---------------------------------------------------------
function addFile(){
 var temp, ext;
 document.mform.filUpload.click();
 if(document.mform.filUpload.value != ""){
  ext = document.mform.filUpload.value;
  ext = ext.substring(ext.length-3,ext.length);
  ext = ext.toLowerCase();
  if ((ext == 'jpg') || (ext == 'gif')) {
   temp = new Option();
   temp.text = document.mform.filUpload.value;
   temp.value = document.mform.filUpload.value;
   document.mform.elements['lstUpload[]'].add(temp, 1);
  }
  else
   alert("Invalid file type selected");
 }
---------------------------------------------------------
    Upon sbumitting, my php script can only read the local drive directory
instead of the
    temporary directory on the server.
    When I did a copy function, it tell me that it cant copy as the source
file does not exist.
    Below is part of my php script.
---------------------------------------------------------
  if(!isset($WINDIR)) $filename = str_replace("\\\\", "\\", $lstUpload[$i]);
    .....
   if(!copy($filename,
"/home/fotohub/public_html/memPhotos/$usrID/$img_name") ){
    echo "Failed to copy"; exit();
   }
----------------------------------------------------------
    Below is my html
----------------------------------------------------------
    <form name="mform" method="post" action="<? echo $PHP_SELF ?>"
enctype="multipart/form-data" onSubmit="return check();">
    ....
    <select name="lstUpload[]" size="8" multiple> </select>
    ....
    <--!  This will create a link Add Foto... which will open up the file
browser window. -->
    <a href='javascript:addFile()'>
    <input id='filUpload' type='file' style='position:absolute;top:-200'
name="file"> Add Foto ... </a>
----------------------------------------------------------
    Can anyone help me out in how to get the temporary file name?

Thanks
     from Triax



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to