datoshway Posted April 6, 2011 Share Posted April 6, 2011 I have one input upload and need it to go to two directories here is my upload code that handles the move_upload_file portion. move_uploaded_file($_FILES['fillPDF']['tmp_name'], $strNewsPath . $strFilename); Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 6, 2011 Share Posted April 6, 2011 After you move the file to one location, copy it to the second location using copy(): http://php.net/manual/en/function.copy.php Quote Link to comment Share on other sites More sharing options...
datoshway Posted April 6, 2011 Author Share Posted April 6, 2011 Hey thanks for that. Still not working. Here is my snippet. Please let me know what you see wrong here? if ($intContentID > -1) { if (($_FILES['fillPDF']['error'] == UPLOAD_ERR_OK) && ($_FILES['fillPDF']['error'] != UPLOAD_ERR_NO_FILE)) { $arrPathInfo = pathinfo($_FILES['fillPDF']['name']); $strFilename = md5(uniqid(rand(), true)) . "." . strtolower($arrPathInfo['extension']); move_uploaded_file($_FILES['fillPDF']['tmp_name'], $strNewsPath . $strFilename); copy($_FILES['fillPDF']['tmp_name'], $strNewsPath2 . $strFilename); } Quote Link to comment Share on other sites More sharing options...
datoshway Posted April 6, 2011 Author Share Posted April 6, 2011 Found out my problem, I think with the hash md5 happening before the copy it didn't have a file name for it. I changed it around and seems to be working now. if ($intContentID > -1) { if (($_FILES['fillPDF']['error'] == UPLOAD_ERR_OK) && ($_FILES['fillPDF']['error'] != UPLOAD_ERR_NO_FILE)) { $arrPathInfo = pathinfo($_FILES['fillPDF']['name']); $strFilename = md5(uniqid(rand(), true)) . "." . strtolower($arrPathInfo['extension']); move_uploaded_file($_FILES['fillPDF']['tmp_name'], $strNewsPath . $strFilename) && copy($strNewsPath . $strFilename , $strNewsPath2 . $strFilename); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.