Jump to content

File upload from mapped drive


spike_ph_77

Recommended Posts

I'm trying to copy a file from a network mapped drive onto the webserver.  The problem is that it will read the file, but it won't move/upload the file.  My code that I have so far is this:

 

 

-------------------------------------------------------------------------------------------

index.php:

<form name="imgform" enctype="multipart/form-data" method="POST" action="./do_work.php">

<input type="hidden" name="userfilename" id="userfilename"></input>

Choose a file to strip lines out of: <input name="varFile" type="file" onChange="javascript:top.document.imgform.userfilename.value= top.imgform.varFile.value"></input><br />

<input type="submit" value="Strip Lines" name="strip" />

 

 

-------------------------------------------------------------------------------------------

do_work.php

$file = $_POST['userfilename'];

 

$target_path = "./uploads/";

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

 

echo "<img src='$file'/>";

 

if(move_uploaded_file($file, $target_path))

{

  echo "Moved";

}

else

{

  echo "Not Moved";

}

//copy($file, $target_path);

 

---------------------------------------------------------------------

As you see, if I insert an image to upload it will display the image on the webpage, but it won't move the image to the uploads directory from the I: which is the mapped drive.  I even tried the copy() but again it didn't work.

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/69771-file-upload-from-mapped-drive/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.