Hi,
I need to get temporary path for my uploaded file. I'm trying to make simple .mov preview for upload preview module, but i'm not able to get the correct temporary path for uploaded file so i can embed it. here is simple code:

function upload_preview_upload_preview($file) {

  // Only check for images
  if (strpos($file->filemime, 'image/') === 0) {

      .......

  }
  
// my code starts here
  if(strpos($file->filemime, 'video/quicktime') === 0) {

   //this is critical, i believe this is not correct, i only need to get this $path...
    $path =$_FILES["files"]["tmp_name"][$file->filename];
 
		
    if ($path) {
       
      return array(
        '#type' => 'upload_preview_mov',
        '#value' => file_create_url($path),
      );
  }


 }
}
//movie embed

function theme_upload_preview_mov($element) {
	$mov ='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="150" width="150"> ';
	$mov .='<param name="src" value="'.$element['#value'].'">';
	$mov .='<param name="autoplay" value="false">';
	$mov .='<param name="type" value="video/quicktime" height="150" width="150">';
	$mov .='<embed src="'.$element['#value'].'" height="150" width="150" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/">';
	$mov .='</object>';
return $mov;
}

Comments

sonofkc’s picture

try this

		$fileTempPath = file_check_upload('upload')-> filepath;
		echo '<br>'.$fileTempPath;
rmiddle’s picture

Status: Active » Needs review

OK need to review this patch for inclusion into the dev version.

Thanks
Robert

rmiddle’s picture

Status: Needs review » Closed (won't fix)

this isn't really a patch as more someone asking how to do something that was answerned long ago. I am going to make this wont fix.

rmiddle’s picture

Status: Closed (won't fix) » Closed (works as designed)

Actually I think by design makes more since.

wszxg8866’s picture

print file_directory_temp();