Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Issue With Sending Data To Webserver (https://forums.graalonline.com/forums/showthread.php?t=134268605)

baseman101 08-09-2013 10:11 AM

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


baseman101 08-09-2013 10:07 PM

Update:

I have resolved the issue and edited the OP with useful information for other people who have the same problem :)

cbk1994 08-09-2013 11:09 PM

You don't need to base64 encode the data (therefore less overhead) if you use the cURL functions and POST the data. You didn't post your code so I'm not sure what you're doing, but in general that would be preferable.

baseman101 08-09-2013 11:21 PM

Quote:

Originally Posted by cbk1994 (Post 1721619)
You don't need to base64 encode the data (therefore less overhead) if you use the cURL functions and POST the data. You didn't post your code so I'm not sure what you're doing, but in general that would be preferable.

I have used your func_http class to handle posting the data, but without using base64encode() all image files were corrupted


All times are GMT +2. The time now is 11:47 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.