Jump to content


Photo

Help in File copy/uploading to Internal Web Application


  • Please log in to reply
2 replies to this topic

#1 yumico23

yumico23
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 14 June 2006 - 09:19 AM

Hi,

Can anyone advise me on file upload or copying to internal web-application?

I have internal office leave management system for staff to do up their leaves.
Problem is I can't perform a file upload.
I browse any file from my local server and upload it to our LMS webserver and couldn't work.
I tried both --> move_uploaded_file and copy function but couldnt work still.

Is there any other functions that I could try?
Currently the folder permission is drwxr-xr-x
Owner: Root
Group: Root

Please advise..thank you so much!

The codes are:
$numoffile = 5;
// $file_dir = "/var/www/html/gsy/office/doculms/"; to web intranet
// $file_dir = "./doculms/"; to web intranet
//$file_dir = "/home/gsyglobal/htdocs/uploads/"; to web internet


if ($_POST) {
for ($i=0;$i<$numoffile;$i++) {
if (trim($_FILES['myfiles']['name'][$i])!="") {
$newfile = $file_dir.$_FILES['myfiles']['name'][$i];
echo "Nwe File:". $newfile;
move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile);
$j++;
}
}
}
if (isset($j)&&$j>0) print "Your file(s) has been uploaded.<br>";
print "<form method='post' enctype='multipart/form-data'>";
for($i=0;$i<$numoffile;$i++) {
print "<input type='file' name='myfiles[]' size='30'><br>";
}
print "<input type='submit' name='action' value='Upload'>";
print "</form>";

#2 swatisonee

swatisonee
  • Members
  • PipPipPip
  • Advanced Member
  • 253 posts

Posted 14 June 2006 - 04:12 PM

// $file_dir = "/var/www/html/gsy/office/doculms/"; to web intranet 
// $file_dir = "./doculms/"; to web intranet 
//$file_dir = "/home/gsyglobal/htdocs/uploads/"; to web internet

Have you commented $file_dir just for this post or have you done it in your code too ?
Shishya

#3 yumico23

yumico23
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 15 June 2006 - 03:06 AM


// $file_dir = "/var/www/html/gsy/office/doculms/"; to web intranet 
// $file_dir = "./doculms/"; to web intranet 
//$file_dir = "/home/gsyglobal/htdocs/uploads/"; to web internet

Have you commented $file_dir just for this post or have you done it in your code too ?
[/quote]


HI,

I commented $file_dir after doing the testing.

Also added this code but returned failed. It seems like can't change
the folder permission. Can please advise me what to do?


  if (!chmod($file_path,0777)) 
       $message = "change permission to 777 failed."; 
  else 
    $message = ($result)?"$file_name uploaded successfully." : 
               "Somthing is wrong with uploading a file."; 


Thanks alot!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users