Copy Compiled Files

I have a portable app in the desktop folder

I have a file image.jpg compiled in the Application root.
I’m trying to make a copy of it using the following

if (file_exists(“image.jpg”)){
copy(“image.jpg”, “C:\Users\pc\Desktop\image2.jpg”);
}
A file is created but it’s 0kb in size.

I have the following checkboxes checked
Do not compress the selected file(s) (only stored)
Unpack the file(s) to virtual memory at startup

I’m using version 2018.1

Have you tried to use full paths for image.jpg?
With DOCUMENT_ROOT?

Yep. I’ve tried several things off https://www.exeoutput.com/help/accessingfiles
but I just can’t get it to work.
I had it working in version 1.7.
I kind of need this working asap.
Based on a compiled app with an image compiled in the Application Root. I need the image copying to folder(desktop) the app is in. Any chance you can post the working code please ?

I have same the problem.

Have you tried $_SERVER['DOCUMENT_ROOT'].'image.jpg' instead?

$_SERVER[‘DOCUMENT_ROOT’].‘image.jpg’ gives an error, as slash is missing. With the slash it copying an empty file.

Can you test this and confirm if it’s an actual bug please.

Support is very slow and my last I didn’t get a reply. Do you have any plan of improving support ?
It makes me apprehensive about using the product, as there does seem to be a few issues.
Which is a shame, as I like the product.

Yes, we can confirm that copy() has a bug. Hopefully, we’ll be able to fix it.
Until that, here is a workaround:

$filename = exo_unpackvirtualfile ('image.jpg', '');

$fp1 = fopen($filename, "r") or die("Couldn't open $file for reading!");
$fp2 = fopen("C:\Users\pc\Desktop\image2.jpg", "w") or die("Couldn't open $file for writing!");

$data = fread($fp1, filesize($filename));

fwrite($fp2, $data) or die("Couldn't write data to file!"); 

fclose($fp1); 

fclose($fp2);

That works thanks.