Jump to content

Upload to multiple directories


datoshway

Recommended Posts

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);

	}

 

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);
				  
	}

 

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.