upload files and downloading a pdf file

what data type am i going to put to my uploadedFiles column in my database... uploaded files are in document format or .txt

 also.. how can i make those files converted into pdf files.. also enable users to download it..


forums.asp.net = "great help"

red is the name
3/5/2008 4:49:44 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

7 Replies

Similar Articles

[PageSpeed] 35
Get it on Google Play
Get it on Apple App Store

What kind of database? With SQL Server, its an Image datatype.  If you want ot convert it to a PDF, you need to look at third party add-ons.  There is nothing in the .NET Framework that handles PDFs specifically.


Regards Mike
My site
3/5/2008 8:27:41 PM

varbinary is the datatype you wish to use.

 there's programs out there that converts your text files to pdf before you upload.

 i'm not sure if there's a process that converts all document files as pdf via asp.net. 

Yay for figuring things out.
3/5/2008 8:38:29 PM
if i am going to restrict users to upload pdf files only.. is it still varbinary??? how can i make a download page??? pls give me some tips...

red is the name
3/6/2008 2:25:21 PM

Hi r3dboy68,

Yes , you can also use varbinary in your case.  However, I would like to suggest you not storing those files in database directly. A more general way to do is to stored your uploaded files into a file server, while keep the path in a sql database. Then, when user choose to download, you just extract the server path to users and download would be handled freely by html.

Hope this can help 

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
3/11/2008 4:36:29 AM
your idea is great.. i have pictured it in my mind.. is there any way where i can retrieve data from my database (i put the pathname of my files in jy database) and use it in my c# code?? tnx a lot
red is the name
4/1/2008 3:10:38 PM
your idea is great.. i have pictured it in my mind.. is there any way where i can retrieve data from my database (i put the pathname of my files in jy database) and use it in my c# code?? tnx a lot
red is the name
4/1/2008 3:12:53 PM

Hi r2dboy68,

you can check following threads for detailed information




Hope my suggestion helps

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
4/2/2008 9:05:36 AM

Similar Artilces:

File Upload
Hey I've got a fileUpload control on an aspx page that works fine for the accepted file type, .rpts, and brings up the correct error message for not allowed extensions such as .exes and .jpgs. But .pdf files should cause an error message to be displayed, as only .rpt files are allowed to be uploaded, but instead it brings up a blank page like a web500 page. Is there a known bug when attempting to upload pdf's?   Just in case,here's the only relevant code attached to the control:   If uploadFilename.EndsWith(".rpt") = True Then 'ensures only .rp...

How to save Uploaded .pdf files to an sql database filed ? Please I Nedd Help It Very Urgent
I created insertdatafilelink.aspx to Insert an Uploaded .pdf files to a filed then when I run insertdatafilelink.aspx it inserts all data to all filed and Uploads the .pdf files to the folder Documents put it doesn't save the .pdf files to the fied file_link. This is the code I used Please I want to know where I made the mistake. 1-This Is the insertdatafilelink.vbPartial Class Insertdatatfilelink Inherits System.Web.UI.PageProtected Sub New_mail_system_ItemInserting(ByVal sender As Object, ByVal e As DetailsViewInsertEventArgs) _ Handles New_mail_system.ItemInserting 'Refere...

My form can do a file upload but can't do a file download (from a sql image column)
Hi everyone, I've created an ASP.NET C# form that displays a record from a SQL database on the web. I can get everything to load fine except for a file stored in an "image" (datatype) field. What I want is the page to display either a picture or a link or something that the user can click to download the file. I can't seem to figure out is: 1. what type of object to put in the form (text link, image, etc.) to allow for a downloadable file. 2. how to assign the file contained in the image column to some sort of variable. For the other columns in the sql table I...

How to File Upload and Download file ( .doc/.pdf/.gif/.exl) from server web browser C#
How to File Upload and Download file ( .doc/.pdf/.gif/.exl) from server web browser Please help me Thanking you Saikat   Uploading: Try a Google search for upload file web server asp.net c#. Download: <a href="http://www.mydomain.com/pathtofile">Download Me</a> HTH,RyanRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question HiI want to download this logo.gif . It is possable to download. Download: <a href="http://www.google.com/intl/en/images/logo.gif">Download Me</a> and How to File Upload .doc/.pdf/.gif/.exl file web server C# code. Please help me . Thanking you Saikat   Saikat:I want to download this logo.gif . It is possable to download. Download: <a href="http://www.google.com/intl/en/images/logo.gif">Download Me</a> That is how you would create the hyperlink to download it. Saikat:How to File Upload .doc/.pdf/.gif/.exl file web server C# code. This has already been answered. RyanRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question Hi Please try this. <a href="http://www.google.com/intl/en/images/logo.gif">Download Me</a> I want to download this logo.gif Saikat       Saikat:<a href="http://www.google.com/intl/en/images/logo.gif">Download Me</a> I want to download this logo.gif Right-click hyperlink > Save Target AsRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolsha...

Download a file from sql (doc, txt, xls, pdf) files available in the db to be displayed in a datagrid, gridview, ...
Every search that I come up with is wanting to save the results displayed in the datagrid.  My page would be a list of all documents stored in the database.  Actually what is stored in the database is just a webpath on the server. My sql table has for columns - DocsID , ProjectID, Title, Webpath I was looking for a grid that looked something like this:                                    DocsID    ProjectID                    Title                                       Webpath  Click Me to Download:    1 ,            32,                  My I love SQL.pdf                       C:/servertarget  Click Me to Download:    2 ,            32,  &nb...

File Upload to server and save path to uploaded file into a sql database
   I am trying to upload a file to a server and save the path of the uploaded file to a sql 2005 server. I have some code below but im getting the error Object reference not set to an instance of an object. Any help would be greatful. By the way I got this code from these forums and just tweaked them for my website. 1 Dim Fileupload1 As FileUpload = CType(FindControl("FileUpload1"), FileUpload) 2 Dim filePath1 As Label = CType(FindControl("filePath1"), Label) 3 4 If Fileupload1.HasFile Then 5 Try 6 Fileupload1.SaveAs(Server.MapPath("/images/portfolio/Full/") & Fileupload1.FileName) 7 8 Dim FileuploadName1 As String = Fileupload1.FileName 9 newsPath1.Text = "http://www.mywebsite/images/portfolio/Full/" & FileuploadName1 10 11 Catch ex As Exception 12 newsPath1.Text = "ERROR: " & ex.Message.ToString() 13 End Try 14 Else 15 newsPath1.Text = "" 16 End If 17 18 Dim strConn As String = "Server=db_evo-studios.net; Database=evo_content; User ID=myusername;Password=mypassword;" 19 Dim MySQL As String = "Insert into tbl_portfolio (imgPath1) " & _ 20 "Values (@imgPath1)" 21 Dim MyConn As New Data.SqlClient.SqlConnection(strConn) 22 Dim Cmd As New Data.SqlClient.SqlCommand(MySQL, MyConn) 23 ...

file uploader save file on server and in database and upload this file on client
hi,i have a file uploader control user can attach files (.rar, .zip, etc) and store file folder and path in database. and another user can click of attach link and can download that file. how can i do this please solve out this problem. you can find your problem solution in this link and you can store the file name in your database server.http://www.aspnettutorials.com/tutorials/network/net-fileupload-aspnet2-csharp.aspxPlease Mark as Answred If This Blog has Helped You.RegardsMitesh Darjihttp://www.indianic.comhttp://www.mitatdotnet.blogspot.com As always there are many ways and which ...

File Upload Problem
Hi Everyone,I was grateful to be able to download the code for uploading files into a folder from Sreedhar's web page. The code works well, but whenever there is another new file with the same file name being uploaded into the destination folder, the old file will be replaced. I am wondering if there is any way to solve this problem (How about adding a number to the new file's name, e.g. File1.doc, if there is an existing File.doc?) I am an absolute beginner and any help is deeply appreciated.The original code is as follows: <%@ Page Language="VB" MasterPageFile="~/MasterP...

upload file by file
hi all,   we have project, local in server, more then one people do the update, let's say, if all file local in test, I did the modify in local and build and upload the whole test file into service, it work fine. but if I only upload helloone.aspx. and its Vb file (under test) into service, it did not work( the VB code) , is that a way to only upload file by file to service, thank you   If I understand your problem correctly, I think the problem that you may be having is that after pages are compiled locally they are not being compiled for the entire site.  I would suggest connecting to the server and then running a compile against all of the files on there once a change occurs.  If you (and the other users) have successfully uploaded the changes on to the server, then the entire site needs to be recompiled to replace the various separate compiles."Tell me. I'll forget. Show me, I may remember. But involve me and I'll understand."Chinese ProverbPlease remember to mark the replies as answers if they help....

Posting filepath in file upload control in .NET to the next page and uploading the file from second page
In our application (using C# .NET) there is a form with file upload options. After filling up the form details, the summary of the details need to be shown in the next page before committing the information into the database. Right now, Server.Control is used to transfer the contents to the next page and the form details are retrieved using Request.Form["control id"]. But this is not working for File upload control alone.File upload can not be done in the first page itself, as the foreign key in File upload table gets updated only in second page after confirmation. Therefore, is there a way to transfer the entire file path to the next page and retrieve it there so as to upload the file from the second page?Thanks in advance. Hi use session session["path"]=Fileupload1.PostedFile.FileName  then next page retrieve the file name String spath=Session["path"].ToString()  Regards,M.VenkatesanMy Blog : http://venkat-dotnetsamples.blogspot.comPlease remember to click “Mark as Answer” on the post that helps you,and to click “Unmark as Answer” if a marked post does not actually answer your question.  hi giridharprasad,u sohuld make use of this function to get the full path rather than only FileUpload1.PostedFile.FileName.System.IO.Path.GetFullPath(FileUpload1.PostedFile.FileName)Now if ur using Cross PostBack (using Sever.Transfer) then rather than using Session u can also use HttpContext.Current.Items.Add methode.g. In case of Cr...

How to identify the original file type and restrict the file uploading while using file upload control
 Hi asp.net , I am uploading a file using FileUpload control in asp.net using vb.net.I wrote the code to upload only PDF files. the user can change the extension and change to PDF . I have to check is the file original PDF or not then i have to upload the PDF files only . How to do this ??  Hi, Check the file Mime type for "application/pdf" by looking at the:  FileUpload1.PostedFile.ContentType RegardsSmcoxonNo Gem is ever polished without some friction. Hi smcoxon , Thanks For Replying ,But i found that there is no use using PostedFil...

does anyone know how to upload file and download file?( uplaod data from online site and be able to download by offline site)
for example there in an offline and online website. how can i upload data from the masterfile or database to USB using the online website......(data form the database is converted to csv file) and when the data was uploaded USB by online .data from USB is uploaded to the offline site. Actually i dont have any idea about it...or where to start.. any links?tips?advice?examples?I badly needed it..... Im using Webdeveloper 2005 for the online.and its perfectly working already...can generate csv files and etc.... database is complete also... NOw for the offline Im using VB 6....

Adding file information to SQL database on file upload
Hi there :) I'm in the final stage of my asp.net project and one of the last things I need to do is add the following file information to my SQL server 2000 database when a file is uploaded: First of all I have a resource table to which I need to add: - filename - file_path - file_size (the resource_id has a auto increment value) so that should hopefully be straight forward when the file is uploaded. The next step is to reference the new resource_id in my module_resource table. My module resource table consists of: - resource_id (foreign key) - module_id (foreign k...

4Guys Upload File includes PDF/DOC files
 I'm using the example File Upload Code seen here:http://aspnet.4guysfromrolla.com/articles/120606-1.aspxThis code is great however I want to modify it to dynamically allow any file format. At the moment I have adjusted the code to recognized PDF's and DOC's (see bold text in code). The problem is when I retrieve the files from the Database, the image files exist and show properly, the PDF's work as well, but the DOC files do NOT work.The DOC file download link prompts the user to download the .ASPX file NOT the named DOC file. How can I setup the DOC's download link to download properly? THANKS!!! HERE IS THE CODE BEHIND UPLOAD FUNCTION: 'Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'If Cancel button is clicked, send user to Default 'Response.Redirect("~/Default.aspx") 'End Sub Protected Sub UploadPictureUI_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles UploadPictureUI.ItemInserting 'Reference the FileUpload control Dim UploadedFile As FileUpload = CType(UploadPictureUI.FindControl("UploadedFile"), FileUpload) 'Make sure a file has been successfully uploaded If UploadedFile.PostedFile Is Nothing OrElse String.IsNullOrEmpty(UploadedFile.PostedFile.FileName) OrElse UploadedFile.PostedFile.InputStream Is Nothing Then ShowError...

COnverting image file into PDF file in C#.NET
hi friends, i have a problem in creating a PDF file from an image file. first of all pls clarify what is the internal concept in converting to PDF file. if nay one knows pls mail me the related code if you find any solution pls mail me at spend5mins@yahoo.com thank u all hari babu...

File Upload routine & File download routine
Two questions. For both, Asp.net with vb.net codebehind. #1. Given the following (1) a web form with an upload file control, (2) a string variable SocialSecurityVar that holds a 9-digit social security number that is fetched from the session state, and (3) a string variable ExtVar with no initial valuehow would i code a routine as follows:1. user clicks browse2. user selcts a file to upload to server, clicks ok3. routine reads string variable SocialSecurityVar (say from form or session state) and in a pre-existing direcotry named \DOCS searches for the subdirectory named \DOCS\XXXXXXXXX wher...

Best file upload/download module for large file
Hi, i need a module for uploading and downloading file froma dnn 2.x or 3.x site. I would like to know if is there some module that is able to transfer large file (1GB or more) Thanks in advance Stefano Speerio has a very nice module called file manager pro. He is working on the new version and it looks awesome. (Been beta testing) As for a 1 GB file, the best way to handle this is FTP. In my opinion, anything even near 50 MB or greater should only be transfered this way. Any module that would be able to support a large upload like this would need to open a new thread and ...

Upload all files in folder with file upload control
H i I'm trying to upload all files to a wesite that is in a specific local folder. My code workes fine when I run it locally but when I upload it it fails. I think it looks for the files to upload on the web server and thus cannot find it.  1 Dim files() As String 2 folderExists = System.IO.Directory.Exists(foldername) 3 If folderExists = False Then 4 Label1.Text = "Folder does not exist. Did you enter a folder name or just a file name ?" 5 Exit sub 6 End If 7 files = System.IO.Directory.GetFiles(foldername) 8 For...

File Upload
Hi,  I am using the file upload code at the link below to allows users to upgrade multiple files into  a storage area. http://dotnetslackers.com/community/blogs/basharkokash/archive/2007/09/11/Test.aspx My question is how do I identify which files belong to which user?? On my site i am using ASP membership and before uploading files users must logg on. Does this mean I can use the UserID to identify them or is there another simple wayI I have the file upload in a simple wizard form. Also i am coding in C sharp   Thank you Amereto   You can use the logged...

file upload extensions
Is it possible to upload any/some video files? I tried to add file extentions under the host settings but it didn't work. Wonder if if it's possible in dnn to upload any video files?Thanks. It is possible to upload files of any extension (as far as I know).  You might be hitting a file size constraint?  I've never tried uploading any really huge files - maybe someone else with comment about that?-doug, Powerhouse Data Yes, you can upload video files.  I've uploaded them and used with core modules as well as MediaGallery.  By default, DNN has a max upload size of 8MB...

Deleting A File Uploaded Through File Upload Control
Hello, I have a form which allows a user to upload a file to a virtual drive on our server using the following code: fileInvoice.SaveAs(ConfigurationManager.AppSettings.Get("DocumentPath") + strFileName); //Document Path is defined in the web.config file How can I safely allow a form on a web page to delete the file if they know the exact name of the file. I don't want them to be able to do a wildcard match like test* thanks in advance, mitch  Peace be on you brother, so you want to safely delete the file which the name you know. OK I consider that the name ...

Uploading/Downloading files with .NET Application
What's the best way to go about uploading/downloading/deleting files to and from the server with .NET?  Basically, I am developing a recruiting application and need to code this part to enable the users to upload/download/delete their resumes. Also, how do I make the code create a new folder under an existing folder on the server, and then upload the file at that location?  I will also need to display the user's uploaded resumes when the user navigates to the resume page of the application. How do I read the file names from a specific folder and display them in the browse...

File Upload- Uploads a blank 90kb file
Hi, I'm uploading a 90kb file to both my oracle database and the internet server from asp.net 2.0 via fileupload tag.The file uploads correctly into oracle but uploads with the correct filename but with 0 bytes into my server. Has anyone come across this issue? My Code for saving into my server: Me.filMyFile.SaveAs(Server.MapPath("~/" & "zQ2_" & datever & _ Me.filMyFile.FileName.ToString()))         Please help me solve this issue.Thank YouVic Is the file being created with zero byte?ASP.NET Hosting (HostingFest) Yes, the file uplo...

Download File Without File Download WIndow
When i click on download link in my asp.net web page, its showing "File Download" dialog window first and asks the user whether to Open or Save the file. Is there any way to directly view/open the file in the browser window(IE) without showing the "File Download" dialog window. I m using frame pages and my code behind is vb.net. Thanx in advance, EIPL It depends on the file type your pointed to, the browser settings on the client, and how you refered to the file in your link that pointed to it. What exactaly are you trying to accomplish?  What type of file are you trying to displ...

Web resources about - upload files and downloading a pdf file - asp.net.sql-datasource

Uploading and downloading - Wikipedia, the free encyclopedia
... include a web server , FTP server, email server, or other similar systems. A download can mean either any file that is offered for downloading ...

Dropify Download 2.0 Simplifies Uploading Content To Facebook, Downloading, Sharing
... with Facebook’s Open Graph and allowing users to make files available for download via the social network, and share uploading and downloading ...

I'm Downloading on the App Store on iTunes
Get I'm Downloading on the App Store. See screenshots and ratings, and read customer reviews.

Why is Dropbox so slow at downloading?
I've upgraded to the new version, and have relinked the machine that was upgraded. It's downloading at 5K per second. Why so slow? This is on ...

Password Hacks, Downloading Movies Legally, and Bluetooth Headphones - YouTube
This week on the podcast we're talking about everybody getting hacked, the best browser for privacy, and sex myths debunked. We're also answering ...

Stars fear illegal downloading
Stars fear illegal downloading

You Might Not Get Fined For Downloading Dallas Buyers Club
Dallas Buyers Club pirates and torrenters, there may be a shining light at the end of the dark tunnel ahead of you. The studio behind the movie ...

Australian anti-piracy crusader Graham Burke on illicit downloading, failure and exercise
Anti-piracy crusader Graham Burke says his company will soon be prepared to sue pirates.

Music Piracy - Illegal Downloading - Kazaa - Woman Loses Appeal
US woman loses $222,000 music downloading appeal

iiNet - Illegal Film Downloading - Piracy - Copyright - BitTorrent - File Sharing
IN THE movie industry's landmark case over illegal film downloads, internet service provider iiNet has launched its counter-attack, calling the ...

Resources last updated: 3/29/2016 2:52:16 PM