- Home /
How to load image from redirected server URL?
How to load texture from server redirect url.For example server URL like **http://sample.com/oneserver** it will redirected to **http://sample.com/oneserver/images/img.png**. I found code for upload but not find for download or load as texture. If any one know help me.
I tried it with shorten URL by redirecting Wikipedia image and it worked fine. no need to redirect anything.
links you posted above do not exist anymore so i couldn't test it.
Thank for reply. The link is sample not original. And i use normal code like
" WWW www = new WWW(url); yield return www; renderer.material.mainTexture = www.texture; ".
If i give normal link it work fine but when i use Redirect link it returns question mark.
Answer by SkaredCreations · Dec 19, 2014 at 06:12 PM
Use the WWW class, particularly you'll want to look at www.texture or www.LoadImageIntoTexture The thing about URL redirect does not make any sense, since it's something configured on the web server and not in Unity.
Thank for reply. I use normal code like
" WWW www = new WWW(url); yield return www; renderer.material.mainTexture = www.texture; "
If i give normal link it work fine but when i use Redirect link it returns question mark.
"Redirect" you mean in your server code? It's probably something having to do with how WWW works, when you redirect I think it switches the HTTP code to some 3xx and since it's not a code 200 then WWW won't complete the redirection. What you can do is to have your server code that opens the file (ins$$anonymous$$d of redirection), sets the proper header "ContentType" header and outputs the binary content read from file.
Your answer
Follow this Question
Related Questions
null texture passed to GUI.DrawTexture 0 Answers
C# cannot convert 'char' expression to type 'UnityEngine.Texture' 1 Answer
C# combining Two Textures 3 Answers
how to make high quality textures with low size of downlaod 1 Answer
C# Check If Scripted Gameobject goes Past Variable Gameobject 0 Answers