Showing posts with label system. Show all posts
Showing posts with label system. Show all posts

Monday, March 26, 2012

Text file upload

Does anyone know of any sample code out there that allows a simple text file to be uplaoded and then stored in a SQL2005 database?

I have a system to record reports and it would be great to be able to upload and store the reports in the database and then be able to display them again via a web page linked from the record concerned.

regards

for saving a file in the database ... you have to convert it in the Binary array and save it as Binary.

On other hand ... better idea will be ... which i would do in your case ... save just the Text of the file in your Database ... make extra columns for the file meta data contents ... like ... name ... extension .. when it was created ... eidted.

then you will have more room in your database ... and ... processing in both directions will be alot faster...


Why can't you just save the filename in the database and store the actual file in another directory? That way, if you want to display it on a webpage, you can provide a link to the actual file. It would save a lot more time to do it this way then to go through the trouble of saving the document in a database table.

(In my html)
Upload Attachment:

<asp:FileUpload ID="FileUpload1" runat="server" Height="20" Width="300" BorderColor="#BFBFBE"> File Types: (.doc, .pdf, .rtf, .txt, .xls).pdf, .rtf, .txt, .xls)


(In my code behind)
if (FileUpload1.HasFile) {string fileext = Path.GetExtension(FileUpload1.FileName).ToLower();//rtf, doc, pdf, txt, xlsif (fileext ==".doc" || fileext ==".rtf" || fileext ==".pdf" || fileext ==".txt" || fileext ==".xls") {string uniqueFileName = System.Guid.NewGuid().ToString(); HttpPostedFile hp = FileUpload1.PostedFile; hp.SaveAs(@.Request.ServerVariables["APPL_PHYSICAL_PATH"] +"uploads\\" + uniqueFileName.ToString() + fileext.ToString()); } }
Then call your method that will save the uploaded document to the database. This way, you know all documents will be in the uploads folder (and all files will have unique names). When you go to display this in an html page later on, you'll know the location and will just have to pull the filename from the database.

Why can't you just save the filename in the database and store the actual file in another directory? That way, if you want to display it on a webpage, you can provide a link to the actual file

Acutally i would also prefer this one.

Based on my understanding, I think there may be a performance issue if you store the uploaded file in a database. So, storing the meta-data of the file into a db and the file to a file server is a better solution. Also, if the file is too large in size, i would suggest using a activeX upload control.

thanks.


omerkamal:

On other hand ... better idea will be ... which i would do in your case ... save just the Text of the file in your Database ... make extra columns for the file meta data contents ... like ... name ... extension .. when it was created ... eidted.

then you will have more room in your database ... and ... processing in both directions will be alot faster...

i totally agree with omerkamal ; saving just Text of the file in database (if only textfile is tobe uploaded) would be a better idea for fast processing.,

Text in Image, Question

I know there has to be a real simple solution to this:
<%@dotnet.itags.org. Page Language="c#"%>
<%@dotnet.itags.org. Import Namespace="System.Drawing.Imaging" %>
<%@dotnet.itags.org. Import Namespace="System.Drawing" %>
<%@dotnet.itags.org. Import Namespace="System.Drawing.Drawing2D" %>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Bitmap bmp= new Bitmap(Server.MapPath(Request.QueryString["i"]));
Graphics g=Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias ;
g.DrawString(Request.QueryString["t"],
new Font("verdana",12),SystemBrushes.WindowText, 1, 1);
Response.ContentType="image/jpeg";
bmp.Save(Response.OutputStream, bmp.RawFormat) ;
}
</script>
I have tried adding in stuff and changing stuff, but I just can't do it!
All I want to do is change the font color to white
Thanks in advanceg.ForeColor = Color.White

Saturday, March 24, 2012

Text size on development system and on client?

Greetings,

How should I adjust my text size on my 21(inch) screen so it looks
nicely fit on client's 17(inch), all are with IE 6? I use 'Larger'
text size but it appears large on client's and affecting the overall
look of the aspx page.

MTIA,
Grawsha

ps We all use the same resolution, but I don't know if this is relevanI think all except graphics programs don't care about the actual size of
screen. They usually find place in the screen through system
coordinates(pixels).

So a windows that will occupy full screen in 17 inches monitor with 800 *
600 resolution will also occupy full screen in 21 inches monitor with the
same resolution.
So you should instead worry about the resolution client will use.

I'm not yet familiar with Objects in ASP.NET so I'll simple recommand you to
use Javascript's Screen Object to save screen size infomation in hidden
controls and read them later in the ASP.NET form.

"al" <grawsha2000@.yahoo.com> ?
news:66edfd3c.0405141935.297fef65@.posting.google.c om ?...
> Greetings,
> How should I adjust my text size on my 21(inch) screen so it looks
> nicely fit on client's 17(inch), all are with IE 6? I use 'Larger'
> text size but it appears large on client's and affecting the overall
> look of the aspx page.
>
> MTIA,
> Grawsha
> ps We all use the same resolution, but I don't know if this is relevan

Text size on development system and on client?

Greetings,
How should I adjust my text size on my 21(inch) screen so it looks
nicely fit on client's 17(inch), all are with IE 6? I use 'Larger'
text size but it appears large on client's and affecting the overall
look of the aspx page.
MTIA,
Grawsha
ps We all use the same resolution, but I don't know if this is relevanI think all except graphics programs don't care about the actual size of
screen. They usually find place in the screen through system
coordinates(pixels).
So a windows that will occupy full screen in 17 inches monitor with 800 *
600 resolution will also occupy full screen in 21 inches monitor with the
same resolution.
So you should instead worry about the resolution client will use.
I'm not yet familiar with Objects in ASP.NET so I'll simple recommand you to
use Javascript's Screen Object to save screen size infomation in hidden
controls and read them later in the ASP.NET form.
"al" <grawsha2000@.yahoo.com> ?
news:66edfd3c.0405141935.297fef65@.posting.google.com ?...
> Greetings,
> How should I adjust my text size on my 21(inch) screen so it looks
> nicely fit on client's 17(inch), all are with IE 6? I use 'Larger'
> text size but it appears large on client's and affecting the overall
> look of the aspx page.
>
> MTIA,
> Grawsha
> ps We all use the same resolution, but I don't know if this is relevan