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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.