Hello,
As an experienced webmaster, I've decided to make a way to send certain images and other files to my webserver. I've made a script and scripted my PHP file, and all data gets sent to the server. Everything gets sent to the appropriate folder, but when I try to read images, they will not open. I have successfully opened scripts, text files, ganis, and levels, but this will just not work out for me. I guess I have to encode and decode the image somehow, but how?
Thanks
Edit: The issue was resolved. Here's how I fixed it.
GScript
PHP Code:
if(temp.filename.ends(".png") || temp.filename.ends(".gif") || temp.filename.ends(".mng")) {
temp.data = base64encode(temp.data);
}
PHP
PHP Code:
if(endswith($filename, ".png") || endswith($filename, ".mng") || endswith($filename, ".gif")) {
$data = base64_decode($data);
}
function endswith($string, $test) {
$strlen = strlen($string);
$testlen = strlen($test);
if ($testlen > $strlen) return false;
return substr_compare($string, $test, -$testlen) === 0;
}