Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Not able to download a proper image

$
0
0

Hi everyone, I am getting a .png file from server . I've downloaded it as given in docs . But i when i set it to imageView , it becomes white. I traced the native path of downloaded image , image is there but when i open it , it gives error . When i save this file without png extension , it shows that it is a doc file and consists the path of image on server. here's my code

//here i am uploading my image
 
var file = Ti.Filesystem.createTempFile(myProfile.fn.value+'.png');
        file.write(myProfile.contactImg.image);
        var filepath = file.nativePath;
        updateMyProfile.getCon(Ti.App.Properties.getString('loginUserId'), Ti.App.Properties.getString('loginId'), Ti.App.Properties.getString('loginPWD'), myProfile.fn.value, myProfile.addTxt.value, file);
        Ti.App.Properties.setString('Profilepic', filepath);
here i am downloading image and setting it on imageView
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, y.result.Username +'.png');
                    f.write(y.result.Profilepic);
                    // write to the file
                    var filepath = f.nativePath;
                    Ti.App.Properties.setString('Profilepic', filepath);
                    Ti.API.info('profile pic == ' + y.result.Profilepic);
                    Ti.API.info('profile downloaded pic == ' + filepath);
i am setting image using the filepath.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>