Solved

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

Posted on 2011-02-19
27
1,743 Views
Last Modified: 2013-12-09
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.
0
Comment
Question by:cuzimjoesmith
  • 15
  • 12
27 Comments
 
LVL 6

Expert Comment

by:MatthewP
ID: 34933224
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?


0
 

Author Comment

by:cuzimjoesmith
ID: 34934619
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.
0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34934769
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?
0
 

Author Comment

by:cuzimjoesmith
ID: 34935261
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
0
 

Author Comment

by:cuzimjoesmith
ID: 34935268
MatthewP i dont know what to do with that code on that link you sent, but seems like it could help.
0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34935341
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..

 outf.jpg
0
 
LVL 6

Accepted Solution

by:
MatthewP earned 500 total points
ID: 34935465
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;

$dir=opendir("DIR","images");
@contents=readdir(DIR);
closedir(DIR);

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: " .$!);
        $newfiledata="";
        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;
        close(OUTF);
}
print "Finished converting files\n";

Open in new window

0
 

Author Comment

by:cuzimjoesmith
ID: 34935938
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
0
 

Author Comment

by:cuzimjoesmith
ID: 34935973
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.  
0
 

Author Comment

by:cuzimjoesmith
ID: 34936008
idk if this is what you also meant by SSH but i tried adding directories in the server host,

which the link is
HERE
0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34937091
Can you zip up your images directory and send me the link?
0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34937135
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.
0
 

Author Comment

by:cuzimjoesmith
ID: 34939263
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 ?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:MatthewP
ID: 34939760
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.
0
 

Author Comment

by:cuzimjoesmith
ID: 34939956
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.
0
 

Author Comment

by:cuzimjoesmith
ID: 34939959
i do thank you for your patience. and understanding of my lack of knowledge.
0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34940084
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.

0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34951073
Are you having any luck with this yet?
0
 

Author Comment

by:cuzimjoesmith
ID: 34955325
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.
 
0
 

Author Comment

by:cuzimjoesmith
ID: 34956295
the ftp connect is

host - hypeclan.clanteam.com

username - hypeclan_clanteam

pass - images101

port- none

the images are in images 101/images


0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34957572
Cool they're coming down but its timing out i'll get them back for you tomorrow
0
 

Author Comment

by:cuzimjoesmith
ID: 34957624
yeah the old host is a free one so it will take prob an hour :0
0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34961249
Here you go, is zip ok as I dont want to give out ftp access on a public forum:

http://69.73.136.203/images.zip
http://69.73.136.203/thumbs.zip

0
 

Author Comment

by:cuzimjoesmith
ID: 34963489
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
0
 

Author Comment

by:cuzimjoesmith
ID: 34963743
Success ! thank you so much for taking the time to help me. I appreciate it greatly.
0
 
LVL 6

Expert Comment

by:MatthewP
ID: 34963779
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.
0
 

Author Comment

by:cuzimjoesmith
ID: 34965843
will do. Thanks a lot.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now