Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
August 25, 2008 - Time to Vote for the August 2008 Site of the Month!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 30, 2008, 06:39:19 AM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: Corrupt files when uploaded. Any ideas why?  (Read 548 times)
spartanic
Spacescooter Operator
*****
Offline Offline

Posts: 40


« on: May 30, 2008, 03:52:10 PM »

I have uploaded some zipped files onto my host but whenever someone downloads these files to view they get errors messages such as "corrupt file" or "invalid file". Any idea whats causing this?
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3237



« Reply #1 on: May 30, 2008, 05:20:17 PM »

If they're "zipped" files (usually .zip extension), were you careful to upload them in "BINARY" mode? Do not force "ASCII" mode -- that will definitely corrupt the files.
Logged

spartanic
Spacescooter Operator
*****
Offline Offline

Posts: 40


« Reply #2 on: May 30, 2008, 10:35:22 PM »

Upload in Binary mode? Sorry but how do you do that? How do I know if I'm forcing ASII?
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3237



« Reply #3 on: May 31, 2008, 10:08:35 AM »

Many FTP clients give you a choice of forcing ASCII or BINARY mode on transfers, or letting the system decide for you. Some only let the system look at the file and make the decision. BINARY mode sends everything unchanged, while ASCII mode translates the byte(s) that mark the "end of line" between what they are on the PC and the server. Sometimes there are other options, such as converting to and from EBCDIC (IBM mainframes). If you're not doing anything to specify or force one way or the other, but letting the system decide for itself, there shouldn't be any problem. If you're forcing ASCII, your files will be corrupted. Have you tried downloading them yourself, using the browser (or an FTP client) the way a user would, without explicitly specifying ASCII or BINARY, and seen if the files are corrupted?
Logged

spartanic
Spacescooter Operator
*****
Offline Offline

Posts: 40


« Reply #4 on: May 31, 2008, 09:03:28 PM »

I usually upload my files onto my host here on Lunarpages. When I upload a file it doesn't give you the option of choosing binary or ASCII. Is there a setting in Cpanel where I can check to see if ASCII is being forced?
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3237



« Reply #5 on: June 01, 2008, 07:24:49 AM »

1. What are you using to upload your files? An FTP client (which one)? cPanel > File Manager?
2. Are the files with ".zip" extension on your PC?
3. Is your PC Windows, Mac, Linux, or something else?
4. Is your hosting plan Basic or Business (Linux based), or Windows?
5. How are they accessed by a visitor... a link (<a href="http://...>) or something else?
6. Do you have anything in your .htaccess file(s) defining what a .zip file is? (AddHandler, AddType) Perhaps you have the wrong thing set, and it's telling the system to treat the file as ASCII.
7. If you download the file via FTP, in the same manner as you uploaded it, is it corrupted?
Logged

spartanic
Spacescooter Operator
*****
Offline Offline

Posts: 40


« Reply #6 on: June 05, 2008, 05:48:33 PM »

1. I use the file manager that is located in my cpanel.
2. The files that I upload onto my cpanel are in zipped format. When they're just sitting on my pc then they are not zipped. I only zip when I know I'm going to upload them.
3. I use a PC
4. My host plan is Basic
5. I copy and paste the http:// links onto the emails.
6. I checked the file manager and there are five .htaccess files. The first one is .htaccess and it has this in it:
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml

Second one is called ".htaccess.04-09-08-2.58.03" it has this in it:
AddHandler x-httpd-php5 .php

Third .htaccess file is called "htaccess.04-09-08-2.58.09" and it has nothing in it. The last one is called ".htaccess.12-02-07-7.20.15" and has this in it:
RedirectMatch permanent ^/$ http://garage411.com/index

7. I have downloaded the file that was supposedly corrupted using the file manager and it worked fine for me.
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3237



« Reply #7 on: June 05, 2008, 06:11:17 PM »

1. I use the file manager that is located in my cpanel.
    I don't believe that gives you a choice about whether to use ASCII or BINARY mode -- it decides automatically.

2. The files that I upload onto my cpanel are in zipped format.
    My specific question was, do the zipped files have an extension of ".zip"? If you have something else, like ".txt", the file uploader might  be looking up common file extensions to decide whether to use ASCII or BINARY (and if all else fails, poke around the file to guess which one to use). You didn't rename a zipped file before or after uploading, did you?

3. I use a PC 
    Windows, I presume. In text (human-readable) files, lines end with carriage-return-line-feed (x0D0A).

4. My host plan is Basic
    Which is Linux, where text file lines end with a newline (x0A). This is where the ASCII conversion (if done) takes place.

5. I copy and paste the http:// links onto the emails.
    So your link is something like http://www.yoursite.com/zipfiles/a_zip_file.zip? Did you include the ".zip" file extension in the file as you uploaded it, and in the link?

6. I checked the file manager and there are five .htaccess files.
    The first one (.htaccess) is the current, active one. It appears to have been created by using the cPanel button to enable PHP 5. It should not affect zip file processing. The others (.htaccess-date-time) are backups, and are inactive. Note that in one of them you had activated a redirect, and it's no longer being done (you'll have to add it to the current .htaccess again).

7. I have downloaded the file that was supposedly corrupted using the file manager and it worked fine for me.
    Well, that's interesting. So you can download the file back to your PC and it's OK, but if you access it via a link, it's corrupted? Can you show us just what the link (code) looks like?

One other thing... in cPanel > File Manager, it gives you the option to unzip a zipped file that you've uploaded. You didn't do that, did you? You want to leave the file in its zipped state.
Logged

spartanic
Spacescooter Operator
*****
Offline Offline

Posts: 40


« Reply #8 on: June 05, 2008, 06:24:52 PM »

1. Alrighty
2. The file extension is .zip
3. Windows Vista to be exact.
4. Alrighty
5. Yes I leave the .zip extension alone when uploading and when I send people the download link.
6. Not too sure how to mess with the .htaccess file so I'll leave it alone unless you reccomend I do something with it.
7. I used the same download link that I gave people to download the file and it was ok for me. Perhaps its the other users computer that is currupting the file during the download? Here's an example of the download link:

http://www.carandphoto.com/Repair/S14wiringdiagram.zip

I haven't attempted to unzip anything under the File Manager. The files remain unchanged (.zip) when they are on my pc to when I upload them onto File Manager to when the person on the other end gets it.
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3237



« Reply #9 on: June 05, 2008, 06:49:22 PM »

I just clicked on your link, downloaded and saved the zipped file, unzipped it, and looked at the two .pdf and one .doc file within it. Everything seems to be fine. I'm running Windows XP Home SP2. The file seems to be on your site correctly, so it must be user error in downloading it (that, or Vista is screwed up royally).
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM