Uploaded image files as ASCII, and not Binary, images dont show.

OS: windows 7,
FTP: Using Filezilla,
Webhost that forum is on godaddy, using linux

-link to what the images look like->http://www.hype-clan.com/hypeforum/viewtopic.php?f=49&t=262&sid=b1526f8b889a15c35c46ecb8ecb8363a

The Problem:

Moved my mysql database to new host, and moved phpforum files to new host also.
when uploaded the new php files using filezilla, the filezilla setting where:
-Default transfer settings where on AUTO
-treat files without extension as ASCII file ( this was checked )
-Treat dotfiles as ASCII files. ( this was checked )

so uploaded the php files with these settings

and the pictures where there but all white, and when clicked on thumbnail larger white pic came up with a triangle warning sign.

-- so i went on many forums looking for an answer, i got mixed answers, all around the fact that i didnt upload it in Binary mode or i didnt have the -treat files without extension as ASCII file - unchecked.

so i tried different ways up uploaded just the folder that had the images in it, i tried unchecking the treat files without extension as ASCII files, also unchecked the Treat dotfiles as ASCII files, and put Default transfer setting to binary.

this help a lil, as before all the images were white, and after doing the step above, they end up with blocky colors and some tiny blocks you can see the real image.

then i re-uploaded the entire php folder with all the files, in binary and i just got the same thing as above.

i also tried changing some htcacces code but that didnt seem to help either. ( those files are back to the way the original were)

so im stuck. any help would be great. i tried to provide as much infor about the situation as possible, and all the steps i have taken to try and fix it.

im thinking since the last host for the forum was windows based, and the new host on godaddy is linux, that may be an issue but idk.

Ive been told this can not be done, but there are about 200+ files that i dont want to lose.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

MatthewPConnect With a Mentor Commented:
Do you have SSH access to your server?

If not can you download and install perl to windows from here: http://www.activestate.com/activeperl/downloads

I have included a modified version of that script here. Create a new folder, in this folder put the following:

1 - the script below saved as unftp.pl
2 - a directory called images which contains all the images you want to convert from ascii
3 - a directory called images2

If you have SSH access to the server and are doing this on the server,  just navigate to the directory with the perl script in, and type perl unftp.pl - then hit enter. If you are on windows just double click the perl script itself - a dos prompt should flash up and vanish again and it should be done. Either way, check the images2 folder which should now be full of binary images and see if it has worked.

#!/usr/bin/perl -w

use strict;
my $chr;
my $prv;
my $cr = chr(13);
my $lf = chr(10);
my $crlf = chr(13) . chr(10);
my @contents;
my $dir;
my $file;
my $newfiledata;

my $iscr = 0;


foreach $file (@contents){
        if ($file eq "."){ next; }
        if ($file eq ".."){ next; }
        print "converting file: $file   \n";

        open (INP, "<images/$file") || die $!;
        open (OUTF, ">images2/$file") || die ("Cannot open images2/$file to write to it: " .$!);
        while (read(INP, $chr, 65536) ) {

                $chr = $cr . $chr if $iscr;

                $iscr = 0;
                if (substr($chr, length($chr)-1, 1) eq $cr) {
                        $chr = substr($chr, 0, length($chr)-1);
                        $iscr = 1;

                $chr =~ s/$crlf/$lf/g;
                $newfiledata .= $chr;
        print OUTF $newfiledata;
print "Finished converting files\n";

Open in new window

If you only have ascii versions of the images you will not get them back to the original binary files as data will have been lost.

The images that you are uploading, do they display ok on your local system before upload? Did you get these by downloading from the old server via FTP in ascii mode?

Also I note that these images aren't linking to .jpg or .png but .php files so what is your PHP doing between getting and outputting the source, and is it reading the source in binary mode in the first place?

cuzimjoesmithAuthor Commented:
i downloaded the files on to my desktop as ASCII ( didn not know that at first ) so all the files are ASCII.

idk what my PHP is  doing between getting an dout putting the source, and i dont know where to find that out.

ive seen convert binary to ASCII things out there why can you convert one way and not back the other.

also i am willing to give access to the forum and ftp, for any one that thinks theres a chance that they can help ( only admins or trusted people from this site tho )

as you can see in the link  th images show parts of the real image, i dont see why parts of the images show normal but the rest in that green blocky film stuff.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

http://www.orafaq.com/forum/t/100512/2/ - may be worth a try.

Are your old files not still on the old server? Have you tried getting in touch with the previous host seeing if they have any backups anywhere at all?
cuzimjoesmithAuthor Commented:
no i deleted them :/ didnt think to keep them, but didnt think about  checking old host for back ups worth a try. ill let you know
cuzimjoesmithAuthor Commented:
MatthewP i dont know what to do with that code on that link you sent, but seems like it could help.
Looks like that perl script works - see the attachment!

Does your new server have perl installed? Is it a linux machine? That'd be the easiset way to get them running, let me know..

cuzimjoesmithAuthor Commented:
alright the godaddy host is ran on linux, my machins is windows 7,

SSH access idk

ill try the dl of perl and try that, and then with the new images i just reupload them to the files folder ( which the forum  access's for images) as binary in the FTP program and it should all work
cuzimjoesmithAuthor Commented:
ok well the dling of perl and making those folders and adding the code, it said converting files, but when i re uploaded the files through FTP and the setting on FTP where set to binary, it didnt work the images look the same on the forum. i could be doing something wrong.

if you like, theres a program called Team Viewer, and you can control my computer and see if you can get it to work.  
cuzimjoesmithAuthor Commented:
idk if this is what you also meant by SSH but i tried adding directories in the server host,

which the link is
Can you zip up your images directory and send me the link?
The perl script was not supposed to be in the images directory, the images and images2 need to come off the directory with the perl script in. If you want to run the perl script through the web you will probably need to rename it with a .cgi extention, and will also need to set the permissions on the script to 777 (in filezilla right click the file on the server and select "file permissions" from the list, enter 777 in the numeric value). But it all depends on how your server is set up this may not work.

Send me a link to the zip and I will convert them if you want will prob be quicker and can send you a link back to the zip of correct images.
cuzimjoesmithAuthor Commented:
this is what i did, i made a folder ( left it the default name, new folder) within that folder added the perl script, also within the 'new folder' with the perl script added a folder named images, and one named images 2. if i did something wrong how should i redo it.

im having trouble uploading the files to zip, and a webiste to upload it to, for its 238 mb.

any suggestions ?
It looks like your server isn't set up to parse perl scripts from the server error. Try this:

Rename it to unftp.cgi (your server is more likely to deal with .cgi extentions)
Make sure the file permissions are 755 - see my last post on how to do this

Then try running it through a web browser. Your images2 directory needs to be 777 permissions as well to write the files out.

The script does work as I tried it. Your hosting company may be able to provide more information if it isn't - Perl comes as standard with linux servers normally but it may be disabled in the hosting account or require something else you don't know about so ask them about it.

The link to Active perl for windows should allow you to do it as well if you have a local copy of the files. See how far you can get with those suggestions.
cuzimjoesmithAuthor Commented:
ok, ive tried to do what you said, but as i do not have the same knowledge as you, it seems that i am not getting any luck.

i have conformed that my host supports .pl  and i found out how to enable SSH access, and enabled it.

you say the script works, and you have proof. i ll try and find away for you to access the files or for you to be able to dl them visa versa. but if that fails, i am wiling to give access to my computer to resolve this.

i dont suspect you to destroy my computer.

and im not trying to get out of it the easy way, ive trying to do this for week and week, many different ways and all fail, or i just dont have the knowledge to get it right.

the webserver way i just keep getting the same message as i posted above, and the desktop way says its converting but when uploaded the images are still messed up, so i dont know how to tell if it converted right.

tried many dif ways of doing this, thinking maybe tweaking it somewhat, and hasnt worked.
cuzimjoesmithAuthor Commented:
i do thank you for your patience. and understanding of my lack of knowledge.
Perl isn't the easiest thing to get working if you're new to it. It *has* to be uploaded in ascii, it *has* to have permissions set on the script to execute properly, normally 755 is a good bet, you can also ask your host what permissions to set as it can be configured differently, also the first line of the file actually points to the perl interpreter on the server.

#!/usr/bin/perl -w

This is looking for perl in /usr/bin/perl however it is often found in /usr/local/bin/perl. Again you can check with your host where to find it as it could be somewhere else entirely.

ActivePerl won't destroy your computer, being on windows it doesn't need all the tricky file permissions stuff, it should do the job.

If all else fails I can give you some ftp space to upload them to and I can do it for you, but it really should be fixable without that though, see how you go and shout if you're not getting anywhere.

Are you having any luck with this yet?
cuzimjoesmithAuthor Commented:
well i wanted to try everything with the host before i reported back,

called them the first person didnt know exactly what i wanted to do and said they cant be reliable for images, etc. that get corrupted. ( she didnt understand)

called again,  the second guy was more helpful, we tried to do it the SSH way, but could never get it to let me have access even tho SSH is enabled on the host. and he didnt know enough about the perl, and what exactly it was i wanted to accomplish.

so i figured that i didnt convert them the right way.

and i will call them back once they are converted and know that they are converted the right way then see if they can help.

i have my old hosting account that i will upload the images to and give you the connection infromation, to dl the files, im in the process of uploading them, since it was a free host its not as fast as my other one, so it will take a lil bit to upload.
cuzimjoesmithAuthor Commented:
the ftp connect is

host - hypeclan.clanteam.com

username - hypeclan_clanteam

pass - images101

port- none

the images are in images 101/images

Cool they're coming down but its timing out i'll get them back for you tomorrow
cuzimjoesmithAuthor Commented:
yeah the old host is a free one so it will take prob an hour :0
Here you go, is zip ok as I dont want to give out ftp access on a public forum:

cuzimjoesmithAuthor Commented:
ye i actually perfer zip, and i understand about giving out ftp access, i did because it was a an account that i would never use again and didnt anything important in the files.

ill let you know if this works
cuzimjoesmithAuthor Commented:
Success ! thank you so much for taking the time to help me. I appreciate it greatly.
Thats cool man I hope they are all ok the ftp timed out about 20 times i hope there arent any half images in there or anything but let me know if you find any that arent right.
cuzimjoesmithAuthor Commented:
will do. Thanks a lot.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.