XF 2.2 fopen with \XF\Util\File::getTempFile failing

Dannymh

Active member
I am using code to try to open a temporary file to then use fputcsv to write into it and once completed I use copyFileToAbstractPath to copy the file over into the internal data.

The issue I am having is that I can not get fopen to open the temp file When I call the code it returns

Code:
fopen() expects parameter 1 to be a valid path, resource given

The code I am trying is

PHP:
$tempFileName = \XF\Util\File::getTempFile();
$csvTempFile = fopen($tempFileName, 'a');

This is almost identical to the Sitemap/Builder code apart from not setting the protected tempfilename

What am I missing here? I am trying to avoid hardcoding the csv file path to the full path as I plan a future move to an s3 bucket for my internal_data and data directories and want to make sure I am not backward coding these things, so I want to be working within the flysystem
 
Oops see typing this out always solves the issue. Realised I was feeding $csvTempFile into the copyAbstractPath when I should have been feeding in the $tempFileName as that is the file...
 
Back
Top Bottom