View Single Post
  #1  
Old 08-09-2013, 10:11 AM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
Issue With Sending Data To Webserver

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;
  } 

Last edited by baseman101; 08-09-2013 at 10:07 PM.. Reason: Resolved
Reply With Quote