Gossamer Forum
Home : Products : DBMan : Customization :

Uploading loosing format of document

Quote Reply
Uploading loosing format of document
Hi, The problem is that when I upload a document using the upload.cgi and it is modified to ad the new information to the default.db file. It does add the new information but the formating is lost in the transistion. The uploaded file can have 10 lines but it is put in the default.db file as one line. The code is posted at http://www.jse.net/upload.cgi.txt.
I have tried to reformat the document many different ways but it still comes out in one line. It is a csv text file that I am uploading.

------------------
Sherwin Sales@jse.net
Quote Reply
Re: Uploading loosing format of document In reply to
I don't know anything about csv files. Are they like text files, with a linefeed at the end of each line? If so, the formatting hasn't been lost, really. It just doesn't show up on an html page.

How are you displaying the contents of the file?


------------------
JPD







[This message has been edited by JPDeni (edited October 17, 1999).]
Quote Reply
Re: Uploading loosing format of document In reply to
csv files are comma seperated value files just like the database file. The uploaded file is opened by the upload cgi and then the content of that file is placed in the default.db file. The csv file is a text file. It just makes it all one line when the upload.cgi reads it and puts it in the contents in the default database. Is there a command to keep the formating the same as the uploaded. The uploaded format is the same as the default.db. So that I don't have to do 100+ entries by dbman interface. I can upload the additions to the database. So that when a search is done the changes can be found in the database. Does this help?


------------------
Sherwin Sales@jse.net
Quote Reply
Re: Uploading loosing format of document In reply to
I'm sorry, but I don't know enough about the upload script to be able to tell you how to deal with it.



------------------
JPD





Quote Reply
Re: Uploading loosing format of document In reply to
Carol wrote this mode for the upload.cgi

code:
open(OUTFILE, "<$SAVE_DIRECTORY\/$Filename") or die("couldn't open new file.\nReason: $!"); while (<OUTFILE> ) {
$new_data .= $_; # puts contents of new file into a variable
}
close OUTFILE;
open (DB, ">>$SAVE_DIRECTORY\/$db_file_name") or die("unable to open database: $db_file_name.\nReason: $!");

flock(DB, 2) or die("unable to get exclusive lock on $db_file_name.\nReason: $!");
print DB $new_data; # appends data from new file into database
close DB; # automatically removes file lock
unlink "<$SAVE_DIRECTORY\/$Filename"; # deletes new file

Where the print DB $new_data; is located. Is there a command string that can be used to retain the current format of the copied content?


------------------
Sherwin Sales@jse.net
Quote Reply
Re: Uploading loosing format of document In reply to
Maybe i can help a little bit with your "formatting".
I'm guessing that you mean part of the uploaded record is formatted (as in word proc)text, and you want to display this in a textarea.

I think that DBMan sees `` as line feed.

If you convert the carriage return to `` in your text document, this may help you.

Are you using comma as your database delimiter? You may want to change that.

Sorry if I jumped in "off base"