Welcome to WebmasterWorld Guest from 54.226.27.104

Forum Moderators: incrediBILL

Message Too Old, No Replies

Uploading html file loses formatting

     

drooh

4:01 am on Jan 4, 2012 (gmt 0)

5+ Year Member



Why does this happen sometimes when I upload a file and later go to look at it, it has lost its formatting. meaning, its seems to be all one line. instead of structured?

For example

<html>
<head></head>
<body>
</body>
<html>

Becomes

<html><head></head><body></body><html>

lucy24

4:59 am on Jan 4, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Your browser's View Source function is using a different line-break format than your editor, so the breaks aren't recognized. For an exact explanation we would need to know what OS you're on, what editor, what form of line ending it uses, what ftp program you use to upload and what its settings are ... and possibly a few other things.

Or did you mean that when you upload a file and later download the same file, the carriage returns are gone with the wind?

Raise your hand if you saw the topic title and thought the answer would involve relative links and CSS :)

drooh

5:11 am on Jan 4, 2012 (gmt 0)

5+ Year Member



when you upload a file and later download the same file, the carriage returns are gone with the wind


using notepad++ and winscp

lucy24

5:51 am on Jan 4, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



If you View Source while the file is online, are the line breaks still there? That narrows it down.

Start by checking the settings in your ftp program. A quick look at Fetch, for comparison, tells me that there's a Preference setting under Downloads for line-ending format. In Windows, you need to use CRLF or \r\n. It will probably just say "Windows or DOS format" as opposed to "Unix format". There are even some special line-break markers within unicode, but I doubt those are your problem.

drooh

6:03 am on Jan 4, 2012 (gmt 0)

5+ Year Member



it just seems to happen randomly with 1 file out of a batch

Tzakuk

9:41 am on Jun 5, 2012 (gmt 0)



I am having exactly the same issue uploading to godaddy shared linux hosting. Using Notepad++ and WinSCP also. Anyone have any ideas?

g1smd

6:25 pm on Jun 5, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



@lucy ::raises hand::

I'll shut up now.

lucy24

9:30 pm on Jun 5, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Huh. I thought Forums threads auto-locked after a month or two. Did someone change something?

Do you mean that the file doesn't look right when viewed in the browser, or only that View Source has become illegible? A lot of people don't even care what the source code looks like*, because visible line breaks in html don't have anything to do with line breaks in the source. That is,

<p><br><br><br></p>

looks the same** to your user as
<p>
<br>
<br>
<br>
</p>


* I do. My javascript includes \n in its print output. If I ever get brave and start messing with php, it will do the same.
** Most of the time. There's an exception, but let's not go there. I think it only applied in elderly browsers anyway.

drooh

9:45 pm on Jun 5, 2012 (gmt 0)

5+ Year Member



Its only when I download the file again to edit with notepad++. Im not looking at it with the browser. I suspect it has something to do with file permissions but not sure why some php files would get different permissions that others? Could it be using a networked PC if you create the file from a different machine or directly on that machine. I could see how the PC would see that as different users and possibly assign different permissions to the file? But this gets messed up when uploading it?

g1smd

9:49 pm on Jun 5, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Upload the file to a linux server and your FTP client might correct the line endings. If you download the file again and it doesn't change them back, you'll see what you just described.

Tzakuk

2:26 pm on Jun 6, 2012 (gmt 0)



This seems to be default behavior of WinSCP. I do not know why it has just started doing this, but the solution is simply to change your transfer mode to 'Binary' if you want the file to be uploaded exactly as-is. See the discussion on WinSCP forums here:
[winscp.net...]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month