homepage Welcome to WebmasterWorld Guest from 23.23.22.200
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Uploading html file loses formatting
drooh




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

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




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

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




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

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


using notepad++ and winscp

lucy24




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

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




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

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

Tzakuk




msg:4461547
 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




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

@lucy ::raises hand::

I'll shut up now.

lucy24




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

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




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

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




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

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




msg:4462061
 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...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved