How to copy .php files from Ressources to local machine

bezourox

New member
Joined
Sep 11, 2012
Messages
2
Programming Experience
Beginner
Hi all,

I'm newbee with vb.net and I would like to copy a ressource (php file) to the local hard drive.
I can copy images and text files with

My.Resources.MYimage.Save(SelectedPath)
and
File.Copy(My.Resources.TEXTfile, SelectedPath)

but impossible with .php file....

Do you have any suggestions ?
 
I can copy ... text files with
File.Copy(My.Resources.TEXTfile, SelectedPath)
That is not correct, first parameter is source path and second target path.

To write a text file you can use File.WriteAllText method, and for binary files File.WriteAllBytes method.

The contents of a php file is actually encoded as plain text, but when you add such a file to resources IDE does not detect this and FileType is set to Binary and resource property type becomes Byte(). As such you can write the resource content to file using WriteAllBytes method. You can also change the resource FileType to Text manually (since you know it is just text) and use WriteAllText method to save it to a file.
 
Back
Top